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