Linux 操作系统:gzip 和 gunzip

《Linux 操作系统》gzip 文件压缩程序的用法介绍

Posted by chanweiyan on April 4, 2020

查看使用说明

1
2
3
gzip -h
gunzip -h
zcat -h

gzip 压缩

这里的中括号 [] 通常表示参数可选

1
2
3
4
5
6
7
8
9
gzip [-acdfhlKnNqrtvV] [-level] [-S suffix] [file]

gzip hello.rb # hello.rb.gz

gzip hello.rb.gz
gzip: Input file hello.rb.gz already has .gz suffix

# -c --stdout          write to stdout, keep original files
gzip -c hello.rb

gunzip 解压

1
2
3
4
5
6
7
gunzip [-acdfhlKnNqrtvV] [-level] [-S suffix] [file]

# 解压 hello.rb.gz 到标准输出 std,删除原始文件
gunzip hello.rb.gz # hello.rb

#  -c --stdout          write to stdout, keep original files
gunzip -c hello.rb.gz > hello.rb