uuencode — Encode a file for safe transmission

Format

uuencode [-m] [infile] remotefile

Description

When files are transmitted over a network or over phone lines, nonprintable characters (for example, control characters) may be interpreted as commands, telling the network to do something. In general, therefore, it is not safe to transmit a file if it contains nonprintable characters.

uuencode translates a binary file into a special code that consists entirely of printable characters from the POSIX portable character set. A file encoded in this way is generally safe for transmission over networks and phone lines. uuencode is often used to send binary files through electronic mail.

If an infile is specified on the uuencode command line, uuencode reads that file as input. Otherwise, it reads the standard input. uuencode always writes the encoded result to the standard output. The encoded version of the data is about 35% larger than the original. If the size is a problem, you can shrink the file with compress before encoding it. The recipient must decode it and then uncompress it.

The remotefile command-line argument is the name that the file should be given after it has been transmitted to its destination. Specifying a remotefile operand of /dev/stdout indicates that uudecode is to use standard output. When the file reaches its destination, uudecode can be used to translate the encoded data into its original form. The first line of the encoded file records the file's access permission bits and the remotefile argument.

Because the encoded file consists entirely of printable characters, you may use a text editor to edit the file. Of course, the only things you are likely to edit are the name of the original file or the name of the remote file.

For a summary of the UNIX03 changes to this command, see Shell commands changed for UNIX03.

Options

-m
Encode the output using the MIME Base64 algorithm. If -m is not specified, the historical algorithm is used.

Examples

This command encodes the file long_name.tar.Z so it decodes with the name arc.trz and redirects the output to arc.uue:
uuencode long_name.tar.Z arc.trz > arc.uue

Localization

uuencode uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
1
Failure because of an incorrect command-line option, or a missing command-line argument

Portability

POSIX.2 User Portability Extension, X/Open Portability Guide. Generally found on most UNIX systems.

Related information

uudecode