Note: "zcat" is also the nickname of BruceKingsbury. (homepage)

zcat is used for decompressing ".gz" zipped files and writing them to standard output. It behaves exactly as if you had typed "gzip -d -c" instead (-d decompresses, -c writes to stdout).

On most systems, zcat is a link to gzip, and gzip behaves differently based on what name it was executed as.

See the gzip(1) man page.

User Comments

someone was searching for examples for zcat, so well, why disappoint?

$ ls interestingfile.txt.gz $ zcat interestingfile.txt.gz this is a compressed interesting text file

For the examples above I'd probably use zless, since if a textfile was worthy of being compressed it's likely to have been very large to begin with.

There aren't many places where 'zcat' is the shortest command for the job. Eg. "zcat foo.tgz | tar x" is probably better done by the command "tar xzf foo.tgz"

Probably the best example I can think of would be;

$ zcat patch-x.y.z.gz | patch -p0

Patches are usually compressed, and patch(1) doesn't have a 'compressed' switch like tar(1) does..

Another example (make sure to have your speakers on!)
$ zcat /vmlinuz > /dev/audio

(BruceKingsbury notes; this is a pointless example at best, the difference between compressed and uncompressed executable code, or /dev/urandom for that matter, piped into /dev/audio is fairly insignificant. Also; zcat: /boot/vmlinuz-2.6.5: not in gzip format)

This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.