Working with zcat, zmore and zless Command in Linux
Compression means to keep files together in an archive and to reduce the size of files. Gzip a.k.a. Gunzip is a command in Linux which is used to compress and decompress the files. So in case, you compressed a very large file with gzip and you just want to see what are the contents of the file. As in this case decompression of the file is going to take a lot of time, so in order to save time and view files without decompressing them “zcat” command is used.
Working with zcat command
1. To display contents of a Gzipped file.
$zcat filename.gz
This will print all the contents of the compressed file.
Note: In this case the, name of file is filename.gz.
2. To display contents of multiple compressed files.
$zcat file1.gz file2.gz
It display contents of multiple files together.
Note: In this case the, name of file is file1.gz and file2.gz.
3. To read compressed data even from a terminal and even it is compressed or not.
$zcat -f filename.gz
This displays the content of the file even if the content is binary or is in an encrypted form.
Note: In this case the, name of file is filename.gz.
4. To paginate the output.
$zless filename.gz
$zmore filename.gz
These are the commands used for paginating the output.
Note: In this case the, name of file is filename.gz.
5. To get the properties of the compressed file.
$zcat -l filename.gz
This will display the properties of files like compressed and uncompressed ratio and uncompressed name etc.
Note: In this case the, name of file is filename.gz.
6. To suppress all warnings.
$zcat -q filename.gz
This will suppress all the warnings that will occur in between the execution of the command.
Last Updated :
10 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...