What is a uuencoded mail message or news posting, and how can I decode it?

uuencode is a program that encodes binary files as plain ASCII text so that they can be sent through electronic mail or posted to Usenet newsgroups. The program expands single characters that can't be viewed or printed as normal text into pairs of text characters, and the resulting encoded file is somewhat larger than the original binary file. This process is necessary to prevent mail, news, and terminal programs from misinterpreting the non-text characters in binary files as special instructions.

You can recognize a uuencoded file by its format. There should be a "begin" line, followed by many lines of identical length filled with what looks like gibberish, generally beginning with the letter M. Here's an example:

  begin 644 myfile.zip

These lines should eventually terminate with an "end" line near the end of the file. If this is not the case, you may have a garbled file or a single file from a multi-part message.

Decoding in Unix

If you receive a uuencoded file as a Unix mail message, to decode it:

  1. Copy it to a file (c o in Berkeley Mail).
  2. Edit the file, removing the mail header, any signatures, and any other extraneous information in the text before the "begin" line and after the "end" line.
  3. After you have a clean uuencoded file (e.g., filename.uu), enter:
      uudecode filename.uu
    Replace filename.uu with the name of your file. This will reconstruct the file that was originally encoded.
  4. After running the uudecode command, you will have two files: the original unchanged uuencoded file, and the new decoded file. The decoded file will have the name that was specified at the beginning of the uuencoded file.

If you receive an error message such as "Short file", you may have a corrupted or incomplete uuencoded file. Check to be sure that there is a line that says "end" at the end of the file. You can look at the last few lines of a file named filename.uu by entering:

  tail filename.uu

If there is no "end" line, you are probably missing the remainder of the uuencoded file. If you are trying to decode a file stored in several parts, such as a set of Usenet postings, make sure you have properly stripped off all header and signature information from the pieces and properly concatenated them together. For example, to append filename2.uu, the second part of a two-piece file that contains the "end" line, to the first part, filename1.uu, you would enter:

  cat filename2.uu >> filename1.uu

In this case, you should strip the footer from filename1.uu and the header from filename2.uu, so that all the lines beginning with "M" follow each other without interruption.

Note: Some newsreaders, such as trn, have special commands for easily decoding multi-part posted files.

For more information, at the Unix shell prompt enter:

  man uudecode

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document acup in the Knowledge Base.
Last modified on 2016-11-30 14:06:21.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.