归档命令(4)——gzip

来源:互联网 发布:比尔盖茨编程水平 编辑:程序博客网 时间:2024/06/05 19:53

[root@localhost ~]# gzip –help
Usage: gzip [OPTION]… [FILE]…
Compress or uncompress FILEs (by default, compress FILES in-place).

Mandatory arguments to long options are mandatory for short options too.

  -c, --stdout      在标准输出上写,保持原始文件不变  -d, --decompress  解压缩  -f, --force       强制强制重写输出文件并压缩链接  -h, --help        give this help  -l, --list        列出压缩文件内容  -L, --license     显示软件许可证  -n, --no-name     不保存或恢复原始名称和时间戳  -N, --name        保存或恢复原始名称和时间戳  -q, --quiet       禁止所有警告  -r, --recursive   在目录上递归地操作  -S, --suffix=SUF  在压缩文件上使用后缀SUF  -t, --test        测试压缩文件的完整性  -v, --verbose     详细模式  -V, --version     显示版本号  -1, --fast        压缩更快  -9, --best        压缩更好--rsyncable   Make rsync-friendly archive

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

Report bugs to bug-gzip@gnu.org.

示例

gzip 压缩文件,并删除原始文件

siu@Darling ~/work $ lsa  b  c  dirsiu@Darling ~/work $ gzip asiu@Darling ~/work $ lsa.gz  b  c  dirsiu@Darling ~/work $ 

gzip -v 压缩文件,并显示压缩信息

siu@Darling ~/work $ gzip -v bb:     26.4% -- replaced with b.gzsiu@Darling ~/work $ lsa.gz  b.gz  c  dir
gunzip  解压文件,gunzip == gzip -dsiu@Darling ~/work $ gunzip a.gz siu@Darling ~/work $ lsa  b.gz  c  dir
zcat   不解压而显示压缩文件的内容siu@Darling ~/work $ zcat b.gz Picture perfect memories scattered all around the floorReaching for the phone 'cause I can't fight it anymoreAnd I wonder if I ever cross your mindFor me it happens all the time
gunzip -c   解压文件到标准输出,也就是一解压就输出内容到屏幕,不改动文件siu@Darling ~/work $ gunzip -c b.gz Picture perfect memories scattered all around the floorReaching for the phone 'cause I can't fight it anymoreAnd I wonder if I ever cross your mindFor me it happens all the time
gunzip -l   显示压缩和解压缩的信息,但并不执行解压缩siu@Darling ~/work $ gunzip -l b.gz          compressed        uncompressed  ratio uncompressed_name                154                 182  26.4% bsiu@Darling ~/work $ lsa  b.gz  c  dir
gzip -9 -r   用压缩量最大的方式递归压缩目录中的文件siu@Darling ~/work $ gzip -9 -r dirsiu@Darling ~/work $ lsa  b.gz  c  dirsiu@Darling ~/work $ ls -l dir总用量 12-rw-r--r-- 1 siu siu 154  112 16:22 a.gz-rw-r--r-- 1 siu siu 154  112 16:22 b.gz-rw-r--r-- 1 siu siu 154  112 16:22 c.gz