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#
参数
文件:指定要显示其中文件内容的压缩包。