Uncompress Files Compressed with gzip


Uncompress Files Compressed with gzip

gunzip

Getting files out of a gzipped archive is easy with the gunzip command.

$ ls -l -rw-r--r-- scott scott  224425 paradise_lost.txt.gz $ gunzip paradise_lost.txt.gz $ ls -l -rw-r--r-- scott scott  508925 paradise_lost.txt 


In the same way that gzip removes the original file, leaving you solely with the gzipped result, gunzip removes the .gz file, leaving you with the final gunzipped result. If you want to ensure that you have both, you need to use the -c option (or --stdout or --to-stdout) and pipe the results to the file you want to create.

$ ls -l -rw-r--r-- scott scott  224425 paradise_lost.txt.gz $ gunzip -c paradise_lost.txt.gz > paradise_lost.txt $ ls -l -rw-r--r-- scott scott  508925 paradise_lost.txt -rw-r--r-- scott scott  224425 paradise_lost.txt.gz 


It's probably a good idea to use -c, especially if you plan to keep behind the .gz file or pass it along to someone else. Sure, you could use gzip and create your own archive, but why go to the extra work?

Note

If you don't like the gunzip command, you can also use gzip -d (or --decompress or --uncompress).




Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net