By Alvin Alexander. Last updated: March 19, 2018
Problem: You have a plain text file that has been compressed with the gzip
command, and you'd like to display the file contents with the Unix/Linux cat
or more
commands.
Solution: Instead of using the cat
or more
commands, use their equivalents for working with gz
files, the zcat
and zmore
commands.
For instance, if you want to display the contents of an Apache log file (which is a plain text file) that has been compressed with gzip
, just use the zcat
command, like this:
zcat access_log.gz
Of course almost any Apache log file will be large, and will scroll off the screen quickly, so you'll probably want to use the gzip equivalent of the more
command, zmore
, like this:
zmore access_log.gz