[Next] [Previous] [Up] [Top] [Contents]

8.2 File Archiving, Compression and Conversion

8.2.3 uuencode/uudecode - encode a file

To encode a binary file into 7-bit ASCII use the uuencode command. To decode the file back to binary use the uudecode command. The uu in the names comes because they are part of the Unix-to-Unix CoPy (UUCP) set of commands. The uuencode and uudecode commands are commonly used when sending binary files through e-mail. In e-mail there's no guarantee that 8-bit binary files will be transferred cleanly. So to ensure delivery you should encode the binary file, either directly, on the command line and then include the encoded file, or indirectly, by letting your MIME mailer program do it for you. In a similar manner, the user decodes the file on the receiving end.

Syntax

uuencode [ source_file ] pathname_to_uudecode_to [ > new_file ]

uudecode [ -p ] encoded_file

Common Options

-p send output to standard output, rather than to the default file

Examples

The first line of encoded file includes the permission modes and name that uudecode will use when decoding the file. The file begins and ends with the begin and end keywords, respectively, e.g.:

begin 555 binary_filename

M?T5,1@$" 0 " ( ! %"W #0 5"< T "

M!0 H !4 % 8 T $ - "@ H 4 P

M -0 !$ ! ! ! %"

M%P !0A< % $ $ 4(8 -"& W& W% < 0

M @ !0B T(@ )@ !P O=7-R+VQI8B]L9"YS

M;RXQ ?< 'Y VP "O !VP )8 &6 !G0

M %[ U0 %G !3 ;< #Q %Q !

MEP :P !_ '@ !PP (P

M N0 =H _0 $D Y < #F /L

M01 $' $ & ! P #0A@ 4(8

M" ! 0 !E !@ , T(@ %"( )@ $

M 0 ( ;@ $ ' -"N !0K@ /H

M $ # ', ! P #1J 4:@ #8 !

M !Y 0 , TH %* !=X 0

M@ @ # -/X !3^ "E, $ (4 !

M 4_> )0 0 ". P

; %0 P )@ $

end


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]