PIGZ(1) | General Commands Manual | PIGZ(1) |
pigz
, unpigz
— compress or expand files
pigz |
[-0..9cdFfhiKkLlNnqORrTtz ]
[-11 ] [-b
blocksize] [-I
iterations] [-M
maxsplits] [-p
threads] [-S
suffix] [file ...] |
unpigz |
[-cfhiKkLlNnqRrTtz ] [-b
blocksize] [-p
threads] [-S
suffix] [file ...] |
pigz
compresses using threads to make use
of multiple processors and cores. The input is broken up into 128 KB chunks
with each compressed in parallel. The individual check value for each chunk
is also calculated in parallel. The compressed data is written in order to
the output, and a combined check value is calculated from the individual
check values.
The compressed data format generated is in the gzip, zlib, or single-entry zip format using the deflate compression method. The compression produces partial raw deflate streams which are concatenated by a single write thread and wrapped with the appropriate header and trailer, where the trailer contains the combined check value.
Each partial raw deflate stream is terminated by an empty stored
block (using the Z_SYNC_FLUSH
option of
zlib(3)), in order to end that
partial bit stream at a byte boundary. That allows the partial streams to be
concatenated simply as sequences of bytes. This adds a very small four to
five byte overhead to the output for each input chunk.
The default input block size is 128K, but can be changed with the
-b
option. The number of compress threads is set by
default to the number of online processors, which can be changed using the
-p
option. Specifying -p
1 avoids the use of threads entirely.
The input blocks, while compressed independently, have the last
32K of the previous block loaded as a preset dictionary to preserve the
compression effectiveness of deflating in a single thread. This can be
turned off using the -i
or
--independent
option, so that the blocks can be
decompressed independently for partial error recovery or for random
access.
Decompression can't be parallelized, at least not without
specially prepared deflate streams for that purpose. As a result,
pigz
uses a single thread (the main thread) for
decompression, but will create three other threads for reading, writing, and
check calculation, which can speed up decompression under some
circumstances. Parallel decompression can be turned off by specifying one
process (-dp
1 or
-tp
1).
Compressed files can be restored to their original form using
pigz
-d
or
unpigz
.
-#,
--fast,
--best
-1
or
--fast
indicates the fastest compression method
(less compression) and -9
or
--best
indicates the slowest compression method
(best compression). -0
is no compression.
-11
gives a few percent better compression at a
severe cost in execution time. The default is
-6
.-b,
--blocksize
mmm-c,
--stdout,
--to-stdout
-d,
--decompress,
--uncompress
-F,
--first
-f,
--force
-h,
--help
-I,
--iterations
n-i,
--independent
-K,
--zip
-k,
--keep
-L,
--license
pigz
license and quit.-l,
--list
-M,
--maxsplits
n-N,
--name
-n,
--no-name
-O,
--oneblock
-p,
--processes
n-q,
--quiet,
--silent
-R,
--rsyncable
-r,
--recursive
-S,
--suffix
.sss-T,
--no-time
-t,
--test
-V,
--version
-v,
--verbose
-z,
--zlib
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, 2008, 2009, 2010 Mark Adler <madler@alumni.caltech.edu>
June 15, 2014 | NetBSD 10.99 |