uuencode - Linux


uuencode is a Linux utility used to encode binary files into ASCII text format, primarily for transmission over networks or inclusion in emails where binary data may not be readily supported. This encoding ensures that the binary data can arrive intact without corruption from systems that might not properly interpret binary data.


The basic syntax of the uuencode command is:

uuencode [options] [sourcefile] [remotefile]
  • sourcefile: Specifies the file to encode. If no file is given or if - is used, uuencode reads from standard input.
  • remotefile: Indicates the name that should be used when the file is decoded on the remote system. This does not affect the name of the output file when encoding.


uuencode does not come with a wide array of options as its functionality is specifically focused. Here are the most common flags:

  • -m: Use Base64 encoding instead of the traditional uuencode format. This is newer and more robust, and it is preferred for compatibility with modern systems.
  • --help: Displays the help message and exits.
  • --version: Outputs version information and exits.


  1. Basic Encoding

    uuencode originalfile.txt encodedfile.txt > encodedfile.uue

    This command encodes ‘originalfile.txt’, naming it ‘encodedfile.txt’ in the output, and redirects the encoded contents to ‘encodedfile.uue’.

  2. Encoding from Standard Input

    cat originalfile.txt | uuencode - encodedfile.txt > encodedfile.uue

    Here, the input is piped from cat and uuencode reads from standard input, encoding the data and outputting to ‘encodedfile.uue’.

  3. Using Base64 Encoding

    uuencode -m originalfile.txt encodedfile.txt > encodedfile.b64

    This example uses Base64 encoding for the file, which might be more suitable for certain modern email systems or web applications.

Common Issues

  • Output to Terminal: A common error is failing to redirect the output to a file, which results in the encoded data being dumped to the terminal.
  • Incorrect Filename on Decoding: Ensure accurate ‘remotefile’ naming, as mismatches can cause confusion or errors during decoding.


uuencode can be integrated into shell scripts or combined with mailing utilities to automate the sending of attachments. Here’s an example using mailx:

uuencode report.pdf report.pdf | mailx -s "Monthly Report" user@example.com

This script encodes ‘report.pdf’ and pipes it directly into mailx to send it as an email attachment.

  • uudecode: Decodes encoded files. It’s the counterpart to uuencode.
  • base64: Can encode/decode data using the Base64 encoding scheme, similar to uuencode -m.

For further reading and more advanced usage scenarios, you might consult more detailed documentation available on Linux man pages or online Linux command resources.