PIGZ(1)
๐ PIGZ(1) ๐ General Commands Manual ๐
Okay bestie, this is the pigz manual, and it's giving parallel compression realness โจ
โจ NAME โจ
pigz, unpigz โ compress or expand files ๐ซถ
๐ SYNOPSIS ๐
pigz [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix
] [ name ... ]
unpigz [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S
suffix ] [ name ... ]
๐ DESCRIPTION ๐
okay so pigz is literally built to use threads so it can hit all your processors and cores at once ๐ฅ The input gets chopped into 128 KB chunks, and each chunk gets compressed in parallel. The check value for each chunk is also calculated in parallel, which is so efficient it's unreal ๐ญ The compressed data gets written to the output in order, and then a combined check value is worked out from the individual ones. Iconic.
The output is in the gzip, zlib, or single-entry zip format, all using the deflate compression method ๐ฆ The compressor makes partial raw deflate streams, and one single write thread stitches them together. Then it wraps everything in the right header and trailer, and the trailer holds that combined check value.
Each partial raw deflate stream ends with an empty stored block (that's the Z_SYNC_FLUSH option of zlib) so the partial bit stream finishes on a byte boundary ๐ง That's what lets the streams get glued together as plain sequences of bytes, no drama. The tradeoff is a tiny overhead of about four to five bytes per input chunk. Worth it, honestly ๐ธ
The default input block size is 128K, and you can change it with the -b option. The number of compress threads defaults to the number of online processors, and you can change that with -p. If you want zero threads, -p 1 avoids threads entirely ๐
Here's the tea: the input blocks are compressed independently, but each one gets the last 32K of the previous block loaded as a preset dictionary. That keeps the compression just as good as a single-threaded deflate โจ You can turn this off with the -i or --independent option. Then each block can be decompressed on its own, which is clutch for partial error recovery or random access. It also adds an extra empty block to flag each independent block, prefacing each one with the nine-byte sequence (in hex): 00 00 FF FF 00 00 00 FF FF.
โ ๏ธ Decompression can't be parallelized, at least not without specially prepared deflate streams made for that purpose. So pigz uses a single thread (the main thread) to decompress, but it spins up three extra threads for reading, writing, and check calculation. Those can speed things up in some situations ๐ You can turn parallel decompression off by specifying one process (-dp 1or-tp 1).
All the options on the command line get processed before any names do ๐ If you don't give any names, or you give - as a name (but not after --), the input comes from stdin. If the GZIP or PIGZ environment variables are set, their options get read first, before any command line options. GZIP goes first, then PIGZ.
Want your compressed files back in their original form? Use pigz -d or unpigz ๐ฅน
๐ OPTIONS ๐
-#,--fast,--bestโ Dial the compression speed with a digit#.-1or--fastis the fastest (least compression), and-9or--bestis the slowest (best compression).-0means no compression at all.-11gives a few percent better compression for a seriously brutal hit to execution time, using the zopfli algorithm by Jyrki Alakuijala. The default is-6๐-A,--alias xxxโ Usexxxas the name for any--zipentry coming from stdin. The default name is"-". ๐ง-b,--blocksize mmmโ Set the compression block size tommmK. The default is 128KiB. ๐-c,--stdout,--to-stdoutโ Write all the processed output to stdout. This won't delete anything. ๐ซถ-C,--comment cccโ Include the comment you give in the gzip header or the zip central file header. ๐-d,--decompress,--uncompressโ Decompress the compressed input. ๐ฅ-f,--forceโ Force an overwrite, compress.gzfiles, links, and output to the terminal. Bold move ๐-h,--helpโ Pull up a help screen and quit. ๐-H,--huffmanโ Compress using the Huffman-only strategy. ๐ฆ-i,--independentโ Compress blocks independently so you can recover from damage. ๐ธ-k,--keepโ Don't delete the original file after processing. Your original stays safe ๐ซถ-K,--zipโ Compress to the PKWare zip (.zip) single entry format. โจ-l,--listโ List the contents of the compressed input. ๐-L,--licenseโ Show the pigz license and quit. ๐-m,--no-timeโ Don't store or restore the modification time.-Nmwill store or restore the name but not the modification time. The order of the options matters, so be careful ๐-M,--timeโ Store or restore the modification time.-nMwill store or restore the modification time but not the name. Again, order matters! Modification times only get stored for regular files, not pipes. ๐-n,--no-nameโ Don't store or restore the file name or the modification time. This is the default when decompressing. If the file name isn't restored from the header, the decompressed file gets the name of the compressed file with its suffix stripped. If the modification time isn't restored from the header, the modification time of the compressed file gets used, not the current time. ๐ฅน-N,--nameโ Store or restore both the file name and the modification time. This is the default when compressing. ๐-p,--processes nโ Allow up tonprocesses. The default is the number of online processors. โญ-q,--quiet,--silentโ Print no messages, not even on error. Shh ๐คซ-r,--recursiveโ Process the contents of all subdirectories. ๐-R,--rsyncableโ Input-determined block locations, so rsync plays nice. ๐ซถ-S,--suffix .sssโ Use the suffix.sssinstead of.gzwhen compressing. ๐ฆ-t,--testโ Test the integrity of the compressed input. ๐-U,--rleโ Compress using the run length encoding strategy. ๐ง-v,--verboseโ Get more verbose output. Tell me everything ๐ฅน-V,--versionโ Show the pigz version.-vValso shows the zlib version. โจ-z,--zlibโ Compress to zlib (.zz) instead of gzip format. ๐--โ Every argument after--is treated as a file name, which is handy for names that start with-๐
๐ฅ Options unique to the -11 level ๐ฅ
These only apply to the -11 compression level, so bestie, you know it's serious when you see them ๐
-F,--firstโ Do the iterations first, before the block split. The default is last. ๐-I,--iterations nโ The number of iterations for optimization. The default is 15. ๐ธ-J,--maxsplits nโ The maximum number of split blocks. The default is 15. ๐-O,--oneblockโ Don't split into smaller blocks. The default is block splitting. ๐
๐ซถ COPYRIGHT NOTICE ๐ซถ
This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. ๐
Copyright (C) 2007-2023 Mark Adler <madler@alumni.caltech.edu> ๐
Okay that's the whole pigz manual, bestie ๐ It's the August 19, 2023 version of PIGZ(1), and honestly it's the most main character compression tool out there โจ๐
๐ฆ where this page comes from
- alpine 3.22: pigz-doc 2.8-r1 ยท Zlib
- alpine 3.23: pigz-doc 2.8-r1 ยท Zlib
- alpine 3.24: pigz-doc 2.8-r1 ยท Zlib
- arch rolling: pigz 2.8-2 ยท custom
- centos-stream 10: pigz 2.8-7.el10 ยท Zlib
- debian trixie: pigz 2.8-1
- fedora 43: pigz 2.8-7.fc43 ยท Zlib
- fedora 44: pigz 2.8-8.fc44 ยท Zlib
- nixos 26.05: pigz 2.8
- nixpkgs unstable: pigz 2.8
- opensuse-leap 16.0: pigz 2.8-160000.2.2 ยท Zlib
- opensuse-leap 16.0: pigz 2.8-160000.2.2 ยท Zlib
- opensuse-leap 16.0: pigz 2.8-160000.2.2 ยท Zlib
- opensuse-leap 16.0: pigz 2.8-160000.2.2 ยท Zlib
- ubuntu noble: pigz 2.8-1
- ubuntu questing: pigz 2.8-1
- ubuntu resolute: pigz 2.8-1build1
- ubuntu stonking: pigz 2.8-2ubuntu2
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms