Compression
zcat
View contents of gzip-compressed files without decompressing them.
Synopsis
syntax
zcat [OPTION]... [FILE]...
Examples
View compressed log file
zcat access.log.gz
Search inside compressed file
zcat data.gz | grep 'error'
Count lines in compressed file
zcat file.gz | wc -l
Common options
| Flag | Description |
|---|---|
| -f | Force output even if file is not gzipped |
| -l | List compression statistics |
About zcat
The `zcat` command view contents of gzip-compressed files without decompressing them. Compression commands reduce file sizes for storage and transfer.
Linux supports multiple compression formats, each with different speed and ratio trade-offs. Understanding these tools is essential for working with archives, backups, log rotation, and software distribution packages.
The command accepts 2 commonly used flags shown above, though the full set of options is available in the man page (`man zcat`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Compression Commands
Other commands in the Compression category