美文网首页Linux
Linux命令之zcat(16)

Linux命令之zcat(16)

作者: 3d0829501918 | 来源:发表于2022-11-04 20:33 被阅读0次

zcat命令可以在不真正解压文件的情况下查看到文件内容; zcat将命令行中列出的文件或由标准输入输入的数据解压,解压后的数据写到标准输出;
zcat解压具有正确标志头的文件,而不管其是否带有.gz后缀; zcat与运行gunzip -c命令完全相同

1、功能说明

用于查看压缩文件的内容

2、语法格式

zcat [选项][文件]

3、选项解释

 -S  当后缀不是标准压缩包后缀时使用此选项
 -c  将文件内容写到标注输出
 -d  执行解压缩操作
 -l  显示压缩包中文件的列表
 -L  显示软件许可信息
 -q  禁用警告信息
 -r  在目录上执行递归操作
 -t  测试压缩文件的完整性
 -V  显示指令的版本信息
 -1  更快的压缩速度
 -9  更高的压缩比

4、参考实例

  • 显示压缩包内文件的内容
[root@xiaonong ~]$ zcat spring.log.2022-10-05.0.gz
当文件大时,可以配合less、more、head、grep等使用
  • 显示多个压缩包内文件的内容
[root@xiaonong ~]$ zcat spring.log.2022-10-05.0.gz spring.log.2022-10-04.0.gz
  • 查看指定文件的压缩信息(压缩大小,未压缩大小,比率 ,压缩率)
[root@xiaonong ~]$ zcat -l apache-maven-3.6.3-bin.tar.gz
compressed  uncompressed  ratio  uncompressed_name
9506321     11326976      16.1%  apache-maven-3.6.3-bin.tar
  • 查看普通文件的内容
[root@xiaonong ~]$ zcat -l apache-maven-3.6.3-bin.tar.gz
  • 禁止所有警告
[root@xiaonong ~]$ zcat -q apache-maven-3.6.3-bin.tar.gz
  • 测试压缩文件等完整性
[root@xiaonong ~]$ zcat -t apache-maven-3.6.3-bin.tar.gz
  • 查看压缩文件的内容,并将内容输入到指定文件
[root@xiaonong ~]$ zcat apache-maven-3.6.3-bin.tar.gz > test.txt
  • 显示指令等版本信息
[root@xiaonong ~]$ zcat -V apache-maven-3.6.3-bin.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.

Written by Jean-loup Gailly.
  • 显示软件许可信息
[root@xiaonong ~]$ zcat -L apache-maven-3.6.3-bin.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.

5、拓展说明

xzcat可以查看xz压缩文件的内容。
bzcat解压缩指定的.bz2文件
详细的命令解释请自行搜索。

相关文章

  • Linux命令之zcat(16)

    zcat命令可以在不真正解压文件的情况下查看到文件内容; zcat将命令行中列出的文件或由标准输入输入的数据解压,...

  • Linux命令-zcat

    前言 如果要在不解压缩压缩文件的情况下查看压缩文件的内容,该怎么办? 为此,您需要zcat命令实用程序。 例子: ...

  • Linux-压缩与打包

    gzip与zcat gzip可以说是Linux里应用最广的压缩命令了。gzip可以解开compress(Linux...

  • 每天一个Linux命令之zcat

    zcat命令用于不真正解压缩文件,就能显示压缩包中文件的内容的场合。 语法 zcat(选项)(参数) 选项 -S:...

  • linux常用的解压,压缩,打包

    gzip zcat [root@linux ~]# gzip [-cdt#] 文件名[root@linux ~]#...

  • Linux下gz压缩文件查看

    1命令操作: zcat +文件名.gz

  • Linux 压缩解压缩总结

    本文主要介绍gzip,zcat和bzip2,zcat这两组命令的使用。gzip可以将给定文件进行压缩,压缩后文件的...

  • linux文件访问权限

    参考 Linux 简单修改权限命令 Linux权限详解 命令之 chmod:修改权限 Linux命令:修改文件权限...

  • iptables命令详解

    linux命令之iptables 1、iptables命令简介 iptables命令是Linux上常用的防火墙软件...

  • 文件和文件系统的压缩与打包

    gzip,zcat命令 1.gzip,最广泛的命令,名字为*.gz格式 gzip [-cdtv#] 文件名-c :...

网友评论

    本文标题:Linux命令之zcat(16)

    本文链接:https://www.haomeiwen.com/subject/gbeutdtx.html