pigz

可以用來解壓縮文件,gzip的並行實現升級版

補充說明

pigz命令可以用來解壓縮文件,最重要的是支持多線程並行處理,解壓縮比gzip快。主頁: http://zlib.net/pigz/

語法

1pigz [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]
2unpigz [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]

參數

 1-0 to -9, -11       # Compression level (level 11, zopfli, is much slower)
 2--fast, --best      # Compression levels 1 and 9 respectively
 3-b, --blocksize mmm # Set compression block size to mmmK (default 128K)
 4-c, --stdout        # Write all processed output to stdout (won't delete)
 5-d, --decompress    # Decompress the compressed input
 6-f, --force         # Force overwrite, compress .gz, links, and to terminal
 7-F  --first         # Do iterations first, before block split for -11
 8-h, --help          # Display a help screen and quit
 9-i, --independent   # Compress blocks independently for damage recovery
10-I, --iterations n  # Number of iterations for -11 optimization
11-J, --maxsplits n   # Maximum number of split blocks for -11
12-k, --keep          # Do not delete original file after processing
13-K, --zip           # Compress to PKWare zip (.zip) single entry format
14-l, --list          # List the contents of the compressed input
15-L, --license       # Display the pigz license and quit
16-m, --no-time       # Do not store or restore mod time
17-M, --time          # Store or restore mod time
18-n, --no-name       # Do not store or restore file name or mod time
19-N, --name          # Store or restore file name and mod time
20-O  --oneblock      # Do not split into smaller blocks for -11
21-p, --processes n   # Allow up to n compression threads (default is the number of online processors, or 8 if unknown)
22-q, --quiet         # Print no messages, even on error
23-r, --recursive     # Process the contents of all subdirectories
24-R, --rsyncable     # Input-determined block locations for rsync
25-S, --suffix .sss   # Use suffix .sss instead of .gz (for compression)
26-t, --test          # Test the integrity of the compressed input
27-v, --verbose       # Provide more verbose output
28-V  --version       # Show the version of pigz
29-Y  --synchronous   # Force output file write to permanent storage
30-z, --zlib          # Compress to zlib (.zz) instead of gzip format
31--                  # All arguments after "--" are treated as files

實例

可以結合tar使用, 壓縮命令

1tar -cvf - dir1 dir2 dir3 | pigz -p 8 > output.tgz

解壓命令

1pigz -p 8 -d output.tgz

如果是gzip格式,也支持用tar解壓

1tar -xzvf output.tgz

來源:https://github.com/jaywcjlove/linux-command

最後修改於: Wednesday, January 31, 2024

相關文章:

翻譯: