zcat 命令用于显示压缩包中文件的内容,能够使用 gzip -d 或 gunzip 或 zcat 将压缩文件恢复为原始格式。zcat 与 gunzip -c 相同。html
zcat 命令用于不真正解压缩文件,就能显示压缩包中文件的内容的场合。redis
zcat [ -fhLV ] [ name ... ]
-S #指定gzip格式的压缩包的后缀 -c #将文件内容写到标注输出 -d #执行解压缩操做 -l #显示压缩包中文件的列表 -L #显示软件许可信息 -q #禁用警告信息 -r #在目录上执行递归操做 -t #测试压缩文件的完整性 -V #显示指令的版本信息 -l #更快的压缩速度 -9 #更高的压缩比
打印压缩的内容,将内容传给more命令进行分页显示centos
[root@centos7 ~]# zcat httpd-2.4.46.tar.gz | more
查看压缩属性信息测试
[root@centos7 ~]# zcat -l httpd-2.4.46.tar.gz compressed uncompressed ratio uncompressed_name 9363314 42301440 77.9% httpd-2.4.46.tar compressed #压缩大小 uncompressed #未压缩大小 ratio #压缩比率 uncompressed_name #未压缩文件的名称
查看普通文件(相似于cat功能)centos7
[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
其它实例spa
#测试压缩包的完整性 [root@centos7 ~]# zcat -t httpd-2.4.46.tar.gz #显示软件许可信息 [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.