uuencode(C) 06 January 1993 uuencode(C) Name uuencode, uudecode - encode/decode a binary file for transmission via mail Syntax uuencode [ source_filename ] remote_filename uudecode [ -s ] [ file ] Description 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. uuen- code 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_filename The uuencoded file ends with a one line footer which has the format: end The 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. Examples uuencode can send an encoded file to a user on another system by piping it through the mail(C) command: uuencode source_fname remote_fname | mail system!user. 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: uudecode uuencoded 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: 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 compress(C) to compress the binary before using uuencode, and uncompress(C) after uudecode to recover the file: sum prog compress prog uuencode prog.Z their_prog.Z > LS uudecode LS uncompress their_prog.Z sum their_prog 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. See also mail(C), compress(C), sum(C), uucp(C) and uux(C). Restrictions The file is expanded by 35% (3 bytes become 4 plus control information) causing it to take longer to transmit. 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 direc- tory for the decoded file must exist. (The -s option to uudecode may be used to circumvent these restrictions.)