zcat – Display the Contents of Files in a Compressed Archive

The zcat command is a Linux utility that is used to display the contents of files in a compressed archive. It is a combination of the cat and gzip commands. The zcat command is most commonly used to display the contents of compressed log files without having to decompress them first.


The syntax for the zcat command is as follows:

zcat [options] file.gz

The file.gz argument can be a single file or multiple files separated by space. When executed, zcat reads the compressed file and writes its contents to standard output. This means that the contents of the compressed file are displayed on the terminal window.

Example Usage

To display the contents of a compressed file named access.log.gz, run the following command:

zcat access.log.gz

If you have multiple compressed files that you want to view, you can specify them as separate arguments:

zcat access.log.gz error.log.gz

You can also use the zcat command in combination with other commands, such as grep, to search for specific content within a compressed file:

zcat access.log.gz | grep "404"


The zcat command has only one option:

Option Description
-f Forces zcat to reopen the input file after every write operation. This is useful when the input file is a pipe and the output is redirected to a file.

Troubleshooting Tips

  • If you receive an error message stating that the file format is not recognized, make sure that the file is a compressed file with the .gz extension.
  • If you receive an error message stating that the file cannot be opened, make sure that you have the necessary permissions to access the file.


  • The zcat command is similar to the gzcat command, which is used to display the contents of a single compressed file.
  • The zcat command does not modify the compressed file in any way. It only displays the contents of the file on the terminal.