Wednesday, November 5, 2008

zcat Shell command (UNIX / Linux)

The zcat command allows the user to view the contents of a compressed file without uncompressing that file by writng contents to the standard output. The zcat command does not rename the expanded file or remove the .Z extension.

The command expects compressed input files (i.e. .Z, .gz, or .bz2)

zcat is equivalent to: uncompress -c

Flags

-n Omits the compressed file header from the compressed file.
-V Writes the current version and compile options to standard error.


Example:

zcat file_1.Z wc -l (print the newline counts)

zcat file_1.Z more (filter for paging through text one screenful at a time)