1PIGZ(1) General Commands Manual PIGZ(1)
2
3
4
6 pigz, unpigz - compress or expand files
7
9 pigz [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix
10 ] [ name ... ]
11 unpigz [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suf‐
12 fix ] [ name ... ]
13
15 Pigz compresses using threads to make use of multiple processors and
16 cores. The input is broken up into 128 KB chunks with each compressed
17 in parallel. The individual check value for each chunk is also calcu‐
18 lated in parallel. The compressed data is written in order to the out‐
19 put, and a combined check value is calculated from the individual check
20 values.
21
22 The compressed data format generated is in the gzip, zlib, or single-
23 entry zip format using the deflate compression method. The compression
24 produces partial raw deflate streams which are concatenated by a single
25 write thread and wrapped with the appropriate header and trailer, where
26 the trailer contains the combined check value.
27
28 Each partial raw deflate stream is terminated by an empty stored block
29 (using the Z_SYNC_FLUSH option of zlib), in order to end that partial
30 bit stream at a byte boundary. That allows the partial streams to be
31 concatenated simply as sequences of bytes. This adds a very small four
32 to five byte overhead to the output for each input chunk.
33
34 The default input block size is 128K, but can be changed with the -b
35 option. The number of compress threads is set by default to the number
36 of online processors, which can be changed using the -p option. Speci‐
37 fying -p 1 avoids the use of threads entirely.
38
39 The input blocks, while compressed independently, have the last 32K of
40 the previous block loaded as a preset dictionary to preserve the com‐
41 pression effectiveness of deflating in a single thread. This can be
42 turned off using the -i or --independent option, so that the blocks can
43 be decompressed independently for partial error recovery or for random
44 access. This also inserts an extra empty block to flag independent
45 blocks by prefacing each with the nine-byte sequence (in hex): 00 00 FF
46 FF 00 00 00 FF FF.
47
48 Decompression can't be parallelized, at least not without specially
49 prepared deflate streams for that purpose. As a result, pigz uses a
50 single thread (the main thread) for decompression, but will create
51 three other threads for reading, writing, and check calculation, which
52 can speed up decompression under some circumstances. Parallel decom‐
53 pression can be turned off by specifying one process ( -dp 1 or -tp 1
54 ).
55
56 All options on the command line are processed before any names are pro‐
57 cessed. If no names are provided on the command line, or if "-" is
58 given as a name (but not after "--"), then the input is taken from
59 stdin. If the GZIP or PIGZ environment variables are set, then options
60 are taken from their values before any command line options are pro‐
61 cessed, first from GZIP, then from PIGZ.
62
63 Compressed files can be restored to their original form using pigz -d
64 or unpigz.
65
66
68 -# --fast --best
69 Regulate the speed of compression using the specified digit #,
70 where -1 or --fast indicates the fastest compression method
71 (less compression) and -9 or --best indicates the slowest com‐
72 pression method (best compression). -0 is no compression. -11
73 gives a few percent better compression at a severe cost in exe‐
74 cution time, using the zopfli algorithm by Jyrki Alakuijala.
75 The default is -6.
76
77 -A --alias xxx
78 Use xxx as the name for any --zip entry from stdin (the default
79 name is "-").
80
81 -b --blocksize mmm
82 Set compression block size to mmmK (default 128KiB).
83
84 -c --stdout --to-stdout
85 Write all processed output to stdout (won't delete).
86
87 -C --comment ccc
88 Include the provided comment in the gzip header or zip central
89 file header.
90
91 -d --decompress --uncompress
92 Decompress the compressed input.
93
94 -f --force
95 Force overwrite, compress .gz, links, and to terminal.
96
97 -h --help
98 Display a help screen and quit.
99
100 -H --huffman
101 Compress using the Huffman-only strategy.
102
103 -i --independent
104 Compress blocks independently for damage recovery.
105
106 -k --keep
107 Do not delete original file after processing.
108
109 -K --zip
110 Compress to PKWare zip (.zip) single entry format.
111
112 -l --list
113 List the contents of the compressed input.
114
115 -L --license
116 Display the pigz license and quit.
117
118 -m --no-time
119 Do not store or restore the modification time. -Nm will store or
120 restore the name, but not the modification time. Note that the
121 order of the options is important.
122
123 -M --time
124 Store or restore the modification time. -nM will store or re‐
125 store the modification time, but not the name. Note that the or‐
126 der of the options is important. Modification times are stored
127 only for regular files, not pipes.
128
129 -n --no-name
130 Do not store or restore the file name or the modification time.
131 This is the default when decompressing. When the file name is
132 not restored from the header, the name of the compressed file
133 with the suffix stripped is the name of the decompressed file.
134 When the modification time is not restored from the header, the
135 modification time of the compressed file is used (not the cur‐
136 rent time).
137
138 -N --name
139 Store or restore both the file name and the modification time.
140 This is the default when compressing.
141
142 -p --processes n
143 Allow up to n processes (default is the number of online proces‐
144 sors)
145
146 -q --quiet --silent
147 Print no messages, even on error.
148
149 -r --recursive
150 Process the contents of all subdirectories.
151
152 -R --rsyncable
153 Input-determined block locations for rsync.
154
155 -S --suffix .sss
156 Use suffix .sss instead of .gz (for compression).
157
158 -t --test
159 Test the integrity of the compressed input.
160
161 -U --rle
162 Compress using the run length encoding strategy.
163
164 -v --verbose
165 Provide more verbose output.
166
167 -V --version
168 Show the version of pigz. -vV also shows the zlib version.
169
170 -z --zlib
171 Compress to zlib (.zz) instead of gzip format.
172
173 -- All arguments after "--" are treated as file names (for names
174 that start with "-")
175
176 These options are unique to the -11 compression level:
177
178 -F --first
179 Do iterations first, before block split (default is last).
180
181 -I, --iterations n
182 Number of iterations for optimization (default 15).
183
184 -J, --maxsplits n
185 Maximum number of split blocks (default 15).
186
187 -O --oneblock
188 Do not split into smaller blocks (default is block splitting).
189
191 This software is provided 'as-is', without any express or implied war‐
192 ranty. In no event will the author be held liable for any damages
193 arising from the use of this software.
194
195 Copyright (C) 2007-2023 Mark Adler <madler@alumni.caltech.edu>
196
197
198
199 August 19, 2023 PIGZ(1)