Reading compressed files using 'zcat' commandIf we have thousands of text files and we have compressed these text files for saving the disk space and we want to read it without decompressing it, we can make use of zcat command.
In this example, show the contents of a text file called resume.txt.gz that has been compressed using gzip.
Open the Terminal and then type the following commands.
Display resume.txt.gz on screen.
zcat resume.txt.gz
You can also list a compressed file with zless command or zmore command as shown below.
$ zcat filename.gz | more
$ zcat filename.gz | less
(or)
$ zless filename.gz
$ zmore filename.gzWhen you are not sure whether a file is compressed or not, you can still view the file without worrying about it’s compression status as shown below.
zcat -f file.txtEnjoy