APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/11/25 uuencode, uudecode

Convert a file to an ascii representation that can be safely transmitted through mail gateways, posted on newsgroups, etc.

Nowadays, attaching a file to an email or a newsgroup post is often "behind the scenes" - you don't get involved in the details. And while mail programs do still have to encode attachments, they are more apt to use base64 than uuencode.

Uuencode does have its uses though. You can create a mail message with an attached file simply by:


cat file | uuencode file | mail -s "here's your file" them@somewhere.com
 

Note that the resulting mail message is not the same as a message created with a MIME attachment, though many mail readers will treat it the same way and allow the recipient to save the file simply by clicking on it. See How can I send attachments from the command line?.

A uuencoded file will look something like this

begin 644 t1
@86)C9&5F9PIA8F-D969G"F%B8V1E9F<*86)C9&5F9PH`
`
end
 

If that file were called "t1.uu", you would recreate "t1" by

uudecode t1.uu
 

Uudecode handily ignores things that don't belong to it, so t1.uu could look like this and still decode:

Here's the file you need:
begin 644 t1
@86)C9&5F9PIA8F-D969G"F%B8V1E9F<*86)C9&5F9PH`
`
end

Just uudecode this.
 

You can't send multiple sets that way though; if you have multiple files, tar or cpio them and uuencode that.



Got something to add? Send me email.




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence






Kerio Connect Mailserver

Kerio Samepage

Kerio Control Firewall

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





There is no programming language, no matter how structured, that will prevent programmers from making bad programs. (Larry Flon)





This post tagged: