uudecode [ -s ] [ file ]
The uuencode and uudecode commands are used to convert a binary file to/from ASCII characters for transfer via uucp(C) or other electronic mail delivery systems. This combination can be used over indirect mail links or other non-binary transmission media.
source_filename is the name of the file which is to be uuencoded. uuencode reads from the standard input as the default if this filename is not given.
remote_filename is the name the file will be given at the remote site after it has been uudecoded. You must always supply this argument. It is generally a good idea to give the file to be uuencoded a different name on a remote site to prevent the accidental overwriting of existing files. You may also find it preferable to use a relative pathname rather than an absolute one.
The uuencoded form of the binary file is written to the standard output. This output may be redirected to a file for later transmission, or it may be piped directly into the mail command (see ``Examples'' below).
The remote filename together with the mode (as an octal number) of the source file are encoded into the output as a one line header with the format:
begin mode remote_filenameThe uuencoded file ends with a one line footer which has the format:
endThe uuencoded file is an ordinary text file and can be edited by any text editor to change the mode or remote_filename in the header line.
uudecode reads a uuencoded file (or standard input as default), and recreates the original binary file, giving it the mode and name remote_filename specified in the header line. If the -s argument is specified, the decoded file is written to standard output rather than to the filename (remote_filename) specified in the header line.
The recipient of the file only needs to run uudecode to recover the binary (uudecode discards any extra lines at the beginning or end of the file).
The following example encodes the binary file usr/bin/prog
as the ASCII file uuencoded. This is to be
restored at the remote site as the binary file their_prog:
uuencode /bin/prog their_prog > uuencoded
The binary file, their_prog, is recovered from
uuencoded at the remote site using uudecode:
If you wished to give the decoded binary a different filename and
path, you could edit the header line of the file
uuencoded, or you could redirect the output of
uudecode -s uuencoded > /usr/local/bin/our_prog
You would also use the -s option to redirect output if you do not have write permission on the encoded destination directory.
To counteract the expansion produced by uuencode, use
to compress the binary before using uuencode, and
after uudecode to recover the file:
uuencode prog.Z their_prog.Z > LS
sum(C) is used here to check that the source and remote binaries are the same. If the checksums are different, it is likely that the binary has been corrupted.
The user on the remote system who is invoking uudecode (often uucp) must have write permission on the destination directory specified in the header line of the encoded file. Also, the path to the destination directory for the decoded file must exist. (The -s option to uudecode may be used to circumvent these restrictions.)
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.