Section 13.2. Decoding Files with uudecode

13.2. Decoding Files with uudecode

You'll decode files whenever you receive binary files through emailit's the only way you can use encoded files. Although most email programs and news readers will take care of decoding files for you (and, therefore, you won't need the information here), you may need to do it manually on occasion. (Hint: If you open up a file or an email message and see something like Code Listing 13.3, you've got a little decoding to do. To avoid the gibberish, decode your files, as shown in Code Listing 13.4.

Code Listing 13.3. Use the head command to view the top of a file. The "begin" line is the tipoff that is'a uuencoded file, with 644 permissions and the name of rowboat.jpg.

[ejr@hobbes compression]$ head rowboat.uue begin 664 rowboat.jpg M"<@>H@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@(" M("'@4F%N9&]M(%5.25@@1F]R='5N97,A"@H*"@I)9B!Y;W4G<F4@;F]T('!A M<G0@;V8@=&AE('-O;'5T:6]N+"!Y;W4G<F4@<&%R="!O9B!T:&4@<')E8VEP M:71A=&4N"@H*"@I4:&4@;VYL>2!R96%L;'D@9V]O9"!P;&%C92!T;R!B=7D@ M;'5M8F5R(&ES(&%T(&$@<W1O<F4@=VAE<F4@=&AE(&QU;6)E<@IH87,@86QR M96%D>2!B965N(&-U="!A;F0@871T86-H960@=&]G971H97(@:6X@=&AE(&9O M<FT@;V8@9G5R;FET=7)E+'IF:6YI<VAE9"P@86YD('!U="!I;G-I9&4@8F]X M97,N"B'@("'@("'@("'@("'@("'M+2!$879E($)A<G)Y+"'B5&AE(%1A;6EN M9R!O9B!T:&4@4V-R97<B"@H*"@HB1&ES8V\@:7,@=&\@;75S:6,@=VAA="!% [ejr@hobbes compression]$ 

Code Listing 13.4. Uudecoding files is straightforward.

[ejr@hobbes compression]$ uudecode  rowboat.uue [ejr@hobbes compression]$ ls -l row* -rw-rw-r-1 ejr      users   128886 Jul 27  09:52 rowboat.jpg -rw-r-r-1 ejr       users   177606 Jul 27  09:51 rowboat.uue [ejr@hobbes compression]$ 

To Decode Files with uudecode:

  • uudecode rowboat.uue

    At the shell prompt, type uudecode followed by the name of the file to decode (Code Listing 13.4).


  • When you receive an encoded file, you might have to uncompress or unzip it in addition to decoding it. See the appropriate sections later in this chapter for details.

  • If you have a file that you suspect is uuencoded, use head plus the filename to view the top ten lines of the file. If it's really uuencoded, you'll see a line saying so at the top, as shown in Code Listing 13.3. The 644 in the list is the file's permissions, and rowboat.jpg is the filename that the extracted file will have. See Chapter 5 for highly interesting details about file permissions.

Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: