|
| 1 | +pigz |
| 2 | +=== |
| 3 | + |
| 4 | +可以用来解压缩文件,gzip的并行实现升级版。 |
| 5 | + |
| 6 | +## 补充说明 |
| 7 | + |
| 8 | +`pigz` 命令**可以用来解压缩文件,最重要的是支持多线程并行处理,解压缩比gzip快。主页: [http://zlib.net/pigz/](http://zlib.net/pigz/) |
| 9 | + |
| 10 | +### 语法 |
| 11 | + |
| 12 | +```bash |
| 13 | +pigz [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ... ] |
| 14 | +unpigz [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ... ] |
| 15 | +``` |
| 16 | + |
| 17 | +### 参数 |
| 18 | + |
| 19 | +```bash |
| 20 | +-0 to -9, -11 Compression level (level 11, zopfli, is much slower) |
| 21 | +--fast, --best Compression levels 1 and 9 respectively |
| 22 | +-b, --blocksize mmm Set compression block size to mmmK (default 128K) |
| 23 | +-c, --stdout Write all processed output to stdout (won't delete) |
| 24 | +-d, --decompress Decompress the compressed input |
| 25 | +-f, --force Force overwrite, compress .gz, links, and to terminal |
| 26 | +-F --first Do iterations first, before block split for -11 |
| 27 | +-h, --help Display a help screen and quit |
| 28 | +-i, --independent Compress blocks independently for damage recovery |
| 29 | +-I, --iterations n Number of iterations for -11 optimization |
| 30 | +-J, --maxsplits n Maximum number of split blocks for -11 |
| 31 | +-k, --keep Do not delete original file after processing |
| 32 | +-K, --zip Compress to PKWare zip (.zip) single entry format |
| 33 | +-l, --list List the contents of the compressed input |
| 34 | +-L, --license Display the pigz license and quit |
| 35 | +-m, --no-time Do not store or restore mod time |
| 36 | +-M, --time Store or restore mod time |
| 37 | +-n, --no-name Do not store or restore file name or mod time |
| 38 | +-N, --name Store or restore file name and mod time |
| 39 | +-O --oneblock Do not split into smaller blocks for -11 |
| 40 | +-p, --processes n Allow up to n compression threads (default is the number of online processors, or 8 if unknown) |
| 41 | +-q, --quiet Print no messages, even on error |
| 42 | +-r, --recursive Process the contents of all subdirectories |
| 43 | +-R, --rsyncable Input-determined block locations for rsync |
| 44 | +-S, --suffix .sss Use suffix .sss instead of .gz (for compression) |
| 45 | +-t, --test Test the integrity of the compressed input |
| 46 | +-v, --verbose Provide more verbose output |
| 47 | +-V --version Show the version of pigz |
| 48 | +-Y --synchronous Force output file write to permanent storage |
| 49 | +-z, --zlib Compress to zlib (.zz) instead of gzip format |
| 50 | +-- All arguments after "--" are treated as files |
| 51 | +``` |
| 52 | +
|
| 53 | +### 实例 |
| 54 | +
|
| 55 | +可以结合`tar`使用, 压缩命令 |
| 56 | +
|
| 57 | +```bash |
| 58 | +tar -cvf - dir1 dir2 dir3 | pigz -p 8 > output.tgz |
| 59 | +``` |
| 60 | +
|
| 61 | +解压命令 |
| 62 | +
|
| 63 | +```bash |
| 64 | +pigz -p 8 -d output.tgz |
| 65 | +``` |
| 66 | +
|
| 67 | +如果是gzip格式,也支持用tar解压 |
| 68 | +
|
| 69 | +```bash |
| 70 | +tar -xzvf output.tgz |
| 71 | +``` |
0 commit comments