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