Introduction of the command

The zcat command is used to display the contents of the compressed file. You can use gzip -d, gunzip, or zcat to restore the compressed file to its original format. Zcat is the same as gunzip -c.

The zcat command is used to display the contents of the compressed file without actually decompressing the file.


Syntax format

zcat [ -fhLV ] [ name ...  ]
Copy the code

Option to show

-s # Specifies the suffix of the compressed package in gzip format -c # Writes the contents of the file to the annotation output D # Performs the decompression operation -l # displays the list of files in the compressed package -l # displays software license information -q # disables warning messages -r # performs recursive operations on the directory -t # tests the integrity of the compressed file -v # Display version information of the instruction - L # faster compression speed -9 # Higher compression ratioCopy the code

Application, for example,

Print compressed content and pass the content to the more command for paging display

/ root @ centos7 ~ # zcat HTTPD - 2.4.46. Tar. Gz | moreCopy the code

View compression properties

[root@centos7 ~]# zcat-l httpd-2.4.46.tar.gz compressed uncompressed_name 9363314 42301440 Httpd-2.4.46.tar compressed # size uncompressed # size ratio uncompressed_name # Name of the uncompressed fileCopy the code

View normal files (similar to cat function)

[root@centos7 ~]# zcat -f test.txt
This is a test line
This is a test line
This is a test line
This is also a test line
This is also a test line
This is also also a test line
Copy the code

Other instances

[root@centos7 ~]# zcat -t httpd-2.4.46.tar.gz # Display software license information [root@centos7 ~]# zcat -l httpd-2.4.46.tar.gz gzip 1.5 Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc. Copyright (C) 1993 Jean-loup Gailly. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.Copy the code

Learn one Linux command every day (101) : Pstree

Learn one Linux command per day (102) : TAC

Learn one Linux command every day (103) : dstat