每天学一个 Linux 命令:dstat

命令简介
zcat 命令用于显示压缩包中文件的内容,可以使用 gzip -d 或 gunzip 或 zcat 将压缩文件恢复为原始格式。zcat 与 gunzip -c 相同。

zcat 命令用于不真正解压缩文件,就能显示压缩包中文件的内容的场合。

语法格式
zcat [ -fhLV ] [ name … ]
选项说明
-S #指定gzip格式的压缩包的后缀
-c #将文件内容写到标注输出
-d #执行解压缩操作
-l #显示压缩包中文件的列表
-L #显示软件许可信息
-q #禁用警告信息
-r #在目录上执行递归操作
-t #测试压缩文件的完整性
-V #显示指令的版本信息
-l #更快的压缩速度
-9 #更高的压缩比
应用举例
打印压缩的内容,将内容传给more命令进行分页显示

[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功能)

[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
其它实例

#测试压缩包的完整性
[root@centos7 ~]# zcat -t httpd-2.4.46.tar.gz

#显示软件许可信息
[root@centos7 ~]# zcat -L httpd-2.4.46.tar.gz
gzip 1.5
Copyright © 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright © 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我是黑客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值