gzip和zcat压缩指令

gzip:是目前应用最广的压缩命令,可以解开compress/zip/gzip等软件压缩的文件。


gzip [-cdtv#] filename

参数:



案例:


复制文件manpath.config
u8064179:dwhdld1 > [/tmp]
$ cp /etc/manpath.config ~/tmp


压缩
$ gzip -v manpath.config
manpath.config:  76.2% -- replaced with manpath.config.gz


原文件与压缩文件进行对比
$ ll /etc/manpath.config man*
-rw-r--r-- 1 root     root 11523 2009-02-21 03:37 /etc/manpath.config
-rw-r--r-- 1 u8064179 mgie  2781 2018-06-29 04:47 manpath.config.gz
压缩文件替换之前的文件,原文件不存在了!!


读取压缩文件(原文件为文本文件)
$ zcat manpath.config.gz


解压缩文件
$ ls -l man*
-rw-r--r-- 1 u8064179 mgie 11523 2018-06-29 04:47 manpath.config
原压缩包被删除!!




用-6参数压缩文件,同事保留原文件
$ gzip -6 -c manpath.config > manpath.config.gz

$ ls -l man*
-rw-r--r-- 1 u8064179 mgie 35 2018-06-29 05:11 manpath.config
-rw-rw-r-- 1 u8064179 mgie 63 2018-06-29 05:12 manpath.config.gz

猜你喜欢

转载自blog.csdn.net/vaychen/article/details/80854193
今日推荐