压缩和解压缩文件bzip2 options] [file-list]
bunzip2 [options] [file-list]
bzcat [options] [file-list]
bzip2recover [file]
bzip2程序用来压缩文件,bunzip2用来还原bzip2压缩的文件,bzcat用于显示bzip2压缩文件,bzip2recover用于修复bzip2压缩时损坏的文件
参数
file-list为要压缩/解压缩的一个或多个文件路径名列表
选项
-c 将压缩或者解压缩的结果写到标准输出
-d 解压缩用bzip2压缩的文件,该选项用于bzip2 -d,与bunzip2等价
-f 强制压缩,覆盖已经存在的文件
-k 当压缩或者解压缩文件时不删除输入文件
-q 抑制警告信息,但显示关键信息
-t 验证压缩文件的完整性,如果文件完整,则不显示任何信息
-v 显示压缩或解压缩时的过程信息
示例
bzip2
siu@Darling ~/work $ ls
a b c dir
siu@Darling ~/work $ bzip2 a
siu@Darling ~/work $ ls
a.bz2 b c dir
压缩文件
bzip2 -v
siu@Darling ~/work $ bzip2 -v b
b: 1.123:1, 7.121 bits/byte, 10.99% saved, 182 in, 162 out.
siu@Darling ~/work $ ls
a.bz2 b.bz2 c dir
压缩文件并显示压缩信息
bzcat
siu@Darling ~/work $ bzcat a.bz2
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
显示压缩文件的内容
bunzip2
siu@Darling ~/work $ bunzip2 a.bz2
siu@Darling ~/work $ ls
a b.bz2 c dir
解压文件
bunzip2 -k
siu@Darling ~/work $ bunzip2 -k b.bz2
siu@Darling ~/work $ ls
a b b.bz2 c dir
解压文件,并保留原文件
Tips
bzip2程序的压缩效率比gzip要好