Linux Command/Unix Command — zcat

The Linux zcat command is identical to gunzip -c. It uncompresses either a list of files on the command line or its standard input and writes the uncompressed data on standard output. Zcat uncompresses files that have the correct magic number whether they have a .gz suffix or not.

On some systems, zcat may be installed as gzcat to preserve the original link to compress.

Hand releasing light streams
John M Lund Photography Inc / Getty Images

About the Command

Consider zcat to be a simple gunzip -c alias.

Gzip uses the Lempel-Ziv algorithm used in zip and PKZIP. The amount of compression obtained depends on the size of the input and the distribution of common substrings. Typically, text such as source code or English is reduced by 60 percent to 70 percent. Compression is generally much better than that achieved by LZW (as used in compress), Huffman coding (as used in pack), or adaptive Huffman coding (compact).

Compression is always performed, even if the compressed file is slightly larger than the original. The worst-case expansion is a few bytes for the gzip file header, plus 5 bytes every 32K block, or an expansion ratio of 0.015 percent for large files. Gzip preserves the mode, ownership, and timestamps of files when compressing or decompressing.

Was this page helpful?