bzip2 bunzip2 bzcat && gzip gunzip && rar
(一)bzip2
记住只是针对单个文件而言,不能用于目录
NAME
bzip2, bunzip2 - a block-sorting file compressor, v1.0.6
bzcat - decompresses files to stdout
bzip2recover - recovers data from damaged bzip2 files
SYNOPSIS
bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
bzip2 [ -h|--help ]
bunzip2 [ -fkvsVL ] [ filenames ... ]
bunzip2 [ -h|--help ]
bzcat [ -s ] [ filenames ... ]
bzcat [ -h|--help ]
bzip2recover filename
filename.bz2 becomes filename
filename.bz becomes filename
filename.tbz2 becomes filename.tar
filename.tbz becomes filename.tar
anyothername becomes anyothername.out
几个重要参数:
-d --decompress
Force decompression. bzip2, bunzip2 and bzcat are really the same program, and the decision about what actions to take is done on
the basis of which name is used. This flag overrides that mechanism, and forces bzip2 to decompress.
-z --compress
The complement to -d: forces compression, regardless of the invocation name.
-v --verbose
Verbose mode -- show the compression ratio for each file processed. Further -v's increase the verbosity level, spewing out lots of
information which is primarily of interest for diagnostic purposes.
-1 (or --fast) to -9 (or --best)
Set the block size to 100 k, 200 k ... 900 k when compressing. Has no effect when decompressing. See MEMORY MANAGEMENT below. The
--fast and --best aliases are primarily for GNU gzip compatibility. In particular, --fast doesn't make things significantly faster.
And --best merely selects the default behaviour.
3 #bzip2 -z target 压缩 4 #bzip2 -d target.bz 解压缩 5 6 #bunzip2 target.bz 解压缩
7 #bzcat target.bz 查看压缩文件中内容
(二)gzip
NAME
gzip, gunzip, zcat - compress or expand files
SYNOPSIS
gzip [ -acdfhklLnNrtvV19 ] [--rsyncable] [-S suffix] [ name ... ]
gunzip [ -acfhklLnNrtvV ] [-S suffix] [ name ... ]
zcat [ -fhLV ] [ name ... ]
几个重要的参数:
-d --decompress --uncompress
Decompress.
-v --verbose
Verbose. Display the name and percentage reduction for each file compressed or decompressed.
-# --fast --best
Regulate the speed of compression using the specified digit #, where -1 or --fast indicates the fastest compression method (less com‐
pression) and -9 or --best indicates the slowest compression method (best compression). The default compression level is -6 (that
is, biased towards high compression at expense of speed).
相对与bzip而言没有一个用来压缩的参数 (默认压缩不需要参数)
1 #gzip target 压缩 2 #gzip -d target.gz 解压缩 3 4 #gunzip target.gz 解压缩
(三) rar
打包兼压缩; 可以针对多个文件目录
a Add files to archive.
x Extract files with full path.
v[t] Verbosely list archive [technical]
1 #rar a target.rar file or dir 压缩 2 #rar x target.rar 解压缩