每天回顾linux命令(zcat)

zcat命令
zcat命令用于显示压缩包中文件的内容。

语法

zcat (选项) (参数)

选项
-S:指定gzip格式的压缩包的后缀。当后缀不是标准压缩包后缀时使用此选项,不常用,不加上也可以查看;

root@35d388cf883b:/home/wzm/testgzip# cat testzip
123
root@35d388cf883b:/home/wzm/testgzip# gzip -S .ggzz testzip
root@35d388cf883b:/home/wzm/testgzip# zcat testzip.ggzz
123
root@35d388cf883b:/home/wzm/testgzip# zcat testzip.ggzz -S .ggzz
123
root@35d388cf883b:/home/wzm/testgzip#

-c:将文件内容写到标准输出,不常用,不加上也是写到啊标准输出。
-d:执行解压缩操作,各个版本间有差异,有些版本的zcat没有,比如笔者系统中zcat就无-d。 加上去不报错

Uncompress FILEs to standard output.

  -f, --force       force; read compressed data even from a terminal
  -l, --list        list compressed file contents
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
      --help        display this help and exit
      --version     display version information and exit

With no FILE, or when FILE is -, read standard input.

-l:显示压缩包中文件的列表

root@35d388cf883b:/home/wzm/testgzip# zcat -l testzip.ggzz
         compressed        uncompressed  ratio uncompressed_name
                 32                   4 -50.0% testzip.ggzz
root@35d388cf883b:/home/wzm/testgzip#

-q:不显示警告信息。
-r:在名利上执行递归操作。

root@35d388cf883b:/home/wzm# ls testgzip/
aaa  ret  testzip.ggzz  zip
root@35d388cf883b:/home/wzm# zcat testgzip/ -r

gzip: testgzip//aaa: not in gzip format
123

gzip: testgzip//zip/Testzip: not in gzip format

gzip: testgzip//zip/redis.conf: not in gzip format

gzip: testgzip//zip/addfile.txt: unexpected end of file
root@35d388cf883b:/home/wzm#

-t:测试压缩文件的完整性

root@35d388cf883b:/home/wzm/testgzip# ls
aaa  ret  testzip.ggzz  zip
root@35d388cf883b:/home/wzm/testgzip# zcat testzip.ggzz
123
root@35d388cf883b:/home/wzm/testgzip# zcat testzip.ggzz -t
root@35d388cf883b:/home/wzm/testgzip# zcat -t testzip.ggzz
root@35d388cf883b:/home/wzm/testgzip# zcat -t aaa

gzip: aaa: not in gzip format
root@35d388cf883b:/home/wzm/testgzip#

参数
文件:指定要显示其中文件内容的压缩包。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值