gzip: Invoking gzip
1
1 3 Invoking ‘gzip’
1 *****************
1
1 The format for running the ‘gzip’ program is:
1
1 gzip OPTION ...
1
1 ‘gzip’ supports the following options:
1
1 ‘--stdout’
1 ‘--to-stdout’
1 ‘-c’
1 Write output on standard output; keep original files unchanged. If
1 there are several input files, the output consists of a sequence of
1 independently compressed members. To obtain better compression,
1 concatenate all input files before compressing them.
1
1 ‘--decompress’
1 ‘--uncompress’
1 ‘-d’
1 Decompress.
1
1 ‘--force’
1 ‘-f’
1 Force compression or decompression even if the file has multiple
1 links or the corresponding file already exists, or if the
1 compressed data is read from or written to a terminal. If the
1 input data is not in a format recognized by ‘gzip’, and if the
1 option ‘--stdout’ is also given, copy the input data without change
1 to the standard output: let ‘zcat’ behave as ‘cat’. If ‘-f’ is not
1 given, and when not running in the background, ‘gzip’ prompts to
1 verify whether an existing file should be overwritten.
1
1 ‘--help’
1 ‘-h’
1 Print an informative help message describing the options then quit.
1
1 ‘--keep’
1 ‘-k’
1 Keep (don’t delete) input files during compression or
1 decompression.
1
1 ‘--list’
1 ‘-l’
1 For each compressed file, list the following fields:
1
1 compressed size: size of the compressed file
1 uncompressed size: size of the uncompressed file
1 ratio: compression ratio (0.0% if unknown)
1 uncompressed_name: name of the uncompressed file
1
1 The uncompressed size is given as −1 for files not in ‘gzip’
1 format, such as compressed ‘.Z’ files. To get the uncompressed
1 size for such a file, you can use:
1
1 zcat file.Z | wc -c
1
1 In combination with the ‘--verbose’ option, the following fields
1 are also displayed:
1
1 method: compression method (deflate,compress,lzh,pack)
1 crc: the 32-bit CRC of the uncompressed data
1 date & time: timestamp for the uncompressed file
1
1 The CRC is given as ffffffff for a file not in gzip format.
1
1 With ‘--verbose’, the size totals and compression ratio for all
1 files is also displayed, unless some sizes are unknown. With
1 ‘--quiet’, the title and totals lines are not displayed.
1
1 The ‘gzip’ format represents the input size modulo 2^32, so the
1 uncompressed size and compression ratio are listed incorrectly for
1 uncompressed files 4 GiB and larger. To work around this problem,
1 you can use the following command to discover a large uncompressed
1 file’s true size:
1
1 zcat file.gz | wc -c
1
1 ‘--license’
1 ‘-L’
1 Display the ‘gzip’ license then quit.
1
1 ‘--no-name’
1 ‘-n’
1 When compressing, do not save the original file name and timestamp
1 by default. (The original name is always saved if the name had to
1 be truncated.) When decompressing, do not restore the original
1 file name if present (remove only the ‘gzip’ suffix from the
1 compressed file name) and do not restore the original timestamp if
1 present (copy it from the compressed file). This option is the
1 default when decompressing.
1
1 ‘--name’
1 ‘-N’
1 When compressing, always save the original file name and timestamp;
1 this is the default. When decompressing, restore the original file
1 name and timestamp if present. This option is useful on systems
1 which have a limit on file name length or when the timestamp has
1 been lost after a file transfer.
1
1 ‘--quiet’
1 ‘-q’
1 Suppress all warning messages.
1
1 ‘--recursive’
1 ‘-r’
1 Travel the directory structure recursively. If any of the file
1 names specified on the command line are directories, ‘gzip’ will
1 descend into the directory and compress all the files it finds
1 there (or decompress them in the case of ‘gunzip’).
1
1 ‘--rsyncable’
1 Cater better to the ‘rsync’ program by periodically resetting the
1 internal structure of the compressed data stream. This lets the
1 ‘rsync’ program take advantage of similarities in the uncompressed
1 input when synchronizing two files compressed with this flag. The
1 cost: the compressed output is usually about one percent larger.
1
1 ‘--suffix SUF’
1 ‘-S SUF’
1 Use suffix SUF instead of ‘.gz’. Any suffix can be given, but
1 suffixes other than ‘.z’ and ‘.gz’ should be avoided to avoid
1 confusion when files are transferred to other systems. A null
1 suffix forces gunzip to try decompression on all given files
1 regardless of suffix, as in:
1
1 gunzip -S "" * (*.* for MSDOS)
1
1 Previous versions of gzip used the ‘.z’ suffix. This was changed
1 to avoid a conflict with ‘pack’.
1
1 ‘--synchronous’
1 Use synchronous output, by transferring output data to the output
1 file’s storage device when the file system supports this. Because
1 file system data can be cached, without this option if the system
1 crashes around the time a command like ‘gzip FOO’ is run the user
1 might lose both ‘FOO’ and ‘FOO.gz’; this is the default with
1 ‘gzip’, just as it is the default with most applications that move
1 data. When this option is used, ‘gzip’ is safer but can be
1 considerably slower.
1
1 ‘--test’
1 ‘-t’
1 Test. Check the compressed file integrity.
1
1 ‘--verbose’
1 ‘-v’
1 Verbose. Display the name and percentage reduction for each file
1 compressed.
1
1 ‘--version’
1 ‘-V’
1 Version. Display the version number and compilation options, then
1 quit.
1
1 ‘--fast’
1 ‘--best’
1 ‘-N’
1 Regulate the speed of compression using the specified digit N,
1 where ‘-1’ or ‘--fast’ indicates the fastest compression method
1 (less compression) and ‘--best’ or ‘-9’ indicates the slowest
1 compression method (optimal compression). The default compression
1 level is ‘-6’ (that is, biased towards high compression at expense
1 of speed).
1