Thursday, December 24, 2009

Reading compressed Files

 

I did not know this, but if you need to show a compressed text file on the screen, you do not actually need to uncompress it.

You can use zcat to send the file to the standard output, uncompressed, but the original file remains untouched.

The syntax of the command is:

zcat file.gz

or you can also use,

gunzip -c file.gz

what is going to happen is that the file will be uncompressed on the fly, sent to the standard output (usually screen).

If the .gz file contains more than one file they will be shown in sequence, you can also redirect the output using >.

 
Things You Should Know About Linux !!!