gzip" -- Command" "
GNU utility to compress files
ggzziipp [[ --ccddffhhLLrrttvvVV1199 ]] [[ _f_i_l_e _._._. ]]
The command gzip is the GNU command that
compresses file named on its command line. It will
only attempt to compress regular files.
Whenever possible, gzip replaces each
file with one that has the suffix ..ggzz, while
preserving its ownership and times of last access and last
modification. If the name of file is longer than
12 characters (which prevents gzip from
attaching the suffix ..ggzz), gzip truncates
it and keeps its original name within the compressed file.
If its command line names no file,
gzip compresses what it reads from from the
standard input, and writes it to the standard output.
To restore a compressed file, filter it thorugh the command
gunzip.
gzip uses the Lempel-Ziv algorithm to
perform compression. Under most circumstances, this
algorithm compresses files more tightly than do most other
commonly used techniques, such as the LZW algorithm, Huffman
coding, or adaptive Huffman coding. The amount of
compression obtained depends upon the size of the input and
the distribution of common substrings; in general, it
reduces text by 60% to 70%.
gzip always compresses its input, even if
the compressed file is slightly larger than the original.
The worst-case expansion is a few bytes for the
gzip file header, plus five bytes for every
32-kilobyte block.
Command-Line Options
gzip recognizes the following command-line
options:
- --cc
- Write output to standard output, and do not change the
original file. If the command line names more
than one file, gzip writes to
the standard output a sequence of independently compressed
members. To obtain better compression, concatenate the
files before compressing them.
- --dd
- Decompress each file.
- --ff
- force compression or decompression, even if
file has multiple links or the corresponding file
already exists. Without this option, and when not running
in the background, gzip prompts to verify
whether it should overwrite an existing file.
- --hh
- Help: display a screenful of information on how to run
this program.
- --LL
- Display the gzip license.
- --qq
- Suppress all warning messages.
- --rr
- Recurse: if a file is a directory, compress or
uncompress all files within it.
- --tt
- Test: check the integrity of a compressed file.
- --vv
- Verbose: display the name and percentage reduction for
each file as it is compressed.
- --VV
- Display the version of this command, and the options by
which it was compiled.
- 11--99
- Regulate the speed of compression, on a scale of from
1 to 9. 1
performs the fastest but most superficial compression,
whereas 9 performs the slowest but most
thorough compression. -fast is a synonym
for -1, whereas -best is a
synonym for -9. The default compression level
is -5.
Advanced Usage
You can concatenate multiple compressed files. In this
case, gunzip extracts all members at once.
For example:
gzip -c file1 > foo.gz
gzip -c file2 >> foo.gz
gunzip -c foo
is equivalent to:
cat file1 file2
In case of damage to one member of a .gz
file, other members can still be recovered (if the damaged
member is removed). However, you can get better compression
by compressing all members at once:
cat file1 file2 | gzip > foo.gz
compresses better than:
gzip -c file1 file2 > foo.gz
If you want to recompress concatenated files to get better
compression, type:
zcat old.gz | gzip > new.gz
Environment
gzip reads the environment variable
GZIP for its default options. It
interprets these options first; you can override them by
setting other options on the gzip command
line.
See Also
- commands,
- compress,
- compression,
- gunzip,
- uncompress,
- unpack,
- zcmp,
- zdiff,
- zforce,
- zgrep,
- zmore,
- znew
A
Diagnostics
If all went well, gzip returns zero upon
exiting. If an error occurred, it returns one; if it issued
a warning message, it returns two.
A
gzip can issue the following warning
messages:
- UUssaaggee:: ggzziipp [[--ccddffhhLLrrttvvVV1199]] [[ffiillee ......]]
- The gzip command line contained an
option that gzip does not recognize.
- _f_i_l_e:: aallrreeaaddyy hhaass zz ssuuffffiixx ---- nnoo cchhaannggee
- file already has the suffix ..ggzz; therefore,
gzip assumes that it already is compressed.
- _f_i_l_e nnoott aa rreegguullaarr ffiillee oorr ddiirreeccttoorryy:: iiggnnoorreedd
- A file is not a regular file or directory.
gzip does not attempt to compress devices,
pipes, or other special files.
- _f_i_l_e hhaass _X_X ootthheerr lliinnkkss:: uunncchhaannggeedd
- file has more than one link. By default,
gzip does not compress a file that has
multiple links.
A
Notes
gzip is released under the conditions of
the Free Software Foundation's ``copyleft''. Full source
code is available through the Mark Williams bulletin board.