PIGZ(1)

๐Ÿ“ฆ
version 2.8 ยท 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

๐ŸŽ€ 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 1 or -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 #. -1 or --fast is the fastest (least compression), and -9 or --best is the slowest (best compression). -0 means no compression at all. -11 gives 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 โ€” Use xxx as the name for any --zip entry coming from stdin. The default name is "-". ๐Ÿงš
  • -b, --blocksize mmm โ€” Set the compression block size to mmmK. 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 .gz files, 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. -Nm will 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. -nM will 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 to n processes. 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 .sss instead of .gz when 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. -vV also 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. ๐ŸŽ€

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 โœจ๐Ÿ‘‘