1.Dd June 19, 2010 2.Dt PIGZ 1 3.Os 4.Sh NAME 5.Nm pigz , 6.Nm unpigz 7.Nd compress or expand files 8.Sh SYNOPSIS 9.Nm 10.Op Fl 0..9cdfhiKkLlNnqRrTtz 11.Op Fl b Ar blocksize 12.Op Fl p Ar threads 13.Op Fl S Ar suffix 14.Op Ar 15.Nm unpigz 16.Op Fl cfhiKkLlNnqRrTtz 17.Op Fl b Ar blocksize 18.Op Fl p Ar threads 19.Op Fl S Ar suffix 20.Op Ar 21.Sh DESCRIPTION 22.Nm 23compresses using threads to make use of multiple processors and cores. 24The input is broken up into 128 KB chunks with each compressed in parallel. 25The individual check value for each chunk is also calculated in parallel. 26The compressed data is written in order to the output, and a combined check 27value is calculated from the individual check values. 28.Pp 29The compressed data format generated is in the gzip, zlib, or single-entry 30zip format using the deflate compression method. The compression produces 31partial raw deflate streams which are concatenated by a single write thread 32and wrapped with the appropriate header and trailer, where the trailer 33contains the combined check value. 34.Pp 35Each partial raw deflate stream is terminated by an empty stored block 36(using the 37.Dv Z_SYNC_FLUSH 38option of 39.Xr zlib 3 ) , 40in order to end that partial bit stream at a byte boundary. 41That allows the partial streams to be concatenated simply as sequences 42of bytes. 43This adds a very small four to five byte overhead to the output for 44each input chunk. 45.Pp 46The default input block size is 128K, but can be changed with the 47.Fl b 48option. 49The number of compress threads is set by default to the number 50of online processors, which can be changed using the 51.Fl p 52option. 53Specifying 54.Fl p Ar 1 55avoids the use of threads entirely. 56.Pp 57The input blocks, while compressed independently, have the last 32K of the 58previous block loaded as a preset dictionary to preserve the compression 59effectiveness of deflating in a single thread. 60This can be turned off using the 61.Fl i 62or 63.Fl Fl independent 64option, so that the blocks can be decompressed 65independently for partial error recovery or for random access. 66.Pp 67Decompression can't be parallelized, at least not without specially prepared 68deflate streams for that purpose. 69As a result, 70.Nm 71uses a single thread (the main thread) for decompression, but will 72create three other threads for reading, writing, and check 73calculation, which can speed up decompression under some 74circumstances. 75Parallel decompression can be turned off by specifying one process 76.Fl ( dp Ar 1 77or 78.Fl tp Ar 1 ) . 79.Pp 80Compressed files can be restored to their original form using 81.Nm pigz Fl d 82or 83.Nm unpigz . 84.Sh OPTIONS 85.Bl -tag -width XXiXXXindependentXX 86.It Fl #, Fl Fl fast, Fl Fl best 87Regulate the speed of compression using the specified digit 88.Ar # , 89where 90.Fl 1 91or 92.Fl Fl fast 93indicates the fastest compression method (less compression) 94and 95.Fl 9 96or 97.Fl Fl best 98indicates the slowest compression method (best compression). 99Level 0 is no compression. 100.It Fl b, Fl Fl blocksize Ar mmm 101Set compression block size to 102.Ar mmm 103K (default 128KiB). 104.It Fl c, Fl Fl stdout, Fl Fl to-stdout 105Write all processed output to stdout (won't delete). 106.It Fl d, Fl Fl decompress, Fl Fl uncompress 107Decompress the compressed input. 108.It Fl f, Fl Fl force 109Force overwrite, compress .gz, links, and to terminal. 110.It Fl h, Fl Fl help 111Display a help screen and quit. 112.It Fl i, Fl Fl independent 113Compress blocks independently for damage recovery. 114.It Fl K, Fl Fl zip 115Compress to PKWare zip (.zip) single entry format. 116.It Fl k, Fl Fl keep 117Do not delete original file after processing. 118.It Fl L, Fl Fl license 119Display the 120.Nm pigz 121license and quit. 122.It Fl l, Fl Fl list 123List the contents of the compressed input. 124.It Fl N, Fl Fl name 125Store/restore file name and mod time in/from header. 126.It Fl n, Fl Fl no-name 127Do not store or restore file name in/from header. 128.It Fl p, Fl Fl processes Ar n 129Allow up to n processes (default is the number of online processors) 130.It Fl q, Fl Fl quiet, Fl Fl silent 131Print no messages, even on error. 132.It Fl r, Fl Fl recursive 133Process the contents of all subdirectories. 134.It Fl S, Fl Fl suffix Ar .sss 135Use suffix 136.Ar .sss 137instead of 138.Pa .gz 139(for compression). 140.It Fl T, Fl Fl no-time 141Do not store or restore mod time in/from header. 142.It Fl t, Fl Fl test 143Test the integrity of the compressed input. 144.It Fl V, Fl Fl version 145Show the version of pigz. 146.It Fl v, Fl Fl verbose 147Provide more verbose output. 148.It Fl z, Fl Fl zlib 149Compress to zlib 150.Pq Pa .zz 151instead of gzip format. 152.El 153.Sh COPYRIGHT NOTICE 154This software is provided 'as-is', without any express or implied 155warranty. 156In no event will the author be held liable for any damages 157arising from the use of this software. 158.Pp 159Copyright (C) 2007, 2008, 2009, 2010 160.An Mark Adler Aq madler@alumni.caltech.edu 161