GZIP(1) USER COMMANDS GZIP(1)
NAME
gzip, gunzip, zcat - compress or expand files
SYNOPSIS
gzip [ -cdfhLrtvV19 ] [ name ... ]
gunzip [ -cfhLrtvV ] [ name ... ]
zcat [ -hLV ] [ name ... ]
DESCRIPTION
Gzip reduces the size of the named files using Lempel-Ziv
coding (LZ77). Whenever possible, each file is replaced by
one with the extension .z, while keeping the same ownership
modes, access and modification times. If no files are
specified, the standard input is compressed to the standard
output. If the new file name is too long, gzip truncates it
and keeps the original file name in the compressed file.
Gzip will only attempt to compress regular files. In par-
ticular, it will ignore symbolic links.
Compressed files can be restored to their original form
using gzip -d or gunzip or zcat.
gunzip takes a list of files on its command line and
replaces each file whose name ends with .z or .Z and which
begins with the correct magic number with an uncompressed
file without the original extension.
gunzip can currently decompress files created by gzip, zip,
compress or pack. The detection of the input format is
automatic. When using the first two formats, gunzip checks
a 32 bit CRC. For pack, gunzip checks the uncompressed
length. The compress format was not designed to allow con-
sistency checks. However gunzip is sometimes able to detect
a bad .Z file. If you get an error when uncompressing a .Z
file, do not assume that the .Z file is correct simply
because the standard uncompress does not complain. This gen-
erally means that the standard uncompress does not check its
input, and happily generates garbage output.
Files created by zip can be uncompressed by gzip only if
they have a single member compressed with the 'deflation'
method. This feature is only intended to help conversion of
tar.zip files to the tar.z format. To extract zip files with
several members, use unzip instead of gunzip.
zcat is identical to gunzip -c. zcat uncompresses either a
list of files on the command line or its standard input and
writes the uncompressed data on standard output. zcat will
uncompress files that have the correct magic number whether
they have a .z suffix or not.
Gzip uses the Lempel-Ziv algorithm used in zip and PKZIP.
The amount of compression obtained depends on the size of
the input and the distribution of common substrings. Typi-
cally, text such as source code or English is reduced by
60-70%. Compression is generally much better than that
achieved by LZW (as used in compress), Huffman coding (as
used in pack), or adaptive Huffman coding (compact).
Compression is always performed, even if the compressed file
is slightly larger than the original. The worst case expan-
- 1
- 2
前往页