3 gzip, gunzip, zcat - compress or expand files
6 gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]
7 gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
8 zcat [ -fhLV ] [ name ... ]
11 Gzip reduces the size of the named files using Lempel-Ziv
12 coding (LZ77). Whenever possible, each file is replaced by
13 one with the extension .gz, while keeping the same ownership
14 modes, access and modification times. (The default exten-
15 sion is -gz for VMS, z for MSDOS, OS/2 FAT, Windows NT FAT
16 and Atari.) If no files are specified, or if a file name is
17 "-", the standard input is compressed to the standard out-
18 put. Gzip will only attempt to compress regular files.
20 If the compressed file name is too long for its file system,
21 gzip truncates it. Gzip attempts to truncate only the parts
22 of the file name longer than 3 characters. (A part is del-
23 imited by dots.) If the name consists of small parts only,
24 the longest parts are truncated. For example, if file names
25 are limited to 14 characters, gzip.msdos.exe is compressed
26 to gzi.msd.exe.gz. Names are not truncated on systems which
27 do not have a limit on file name length.
29 By default, gzip keeps the original file name and timestamp
30 in the compressed file. These are used when decompressing
31 the file with the -N option. This is useful when the
32 compressed file name was truncated or when the time stamp
33 was not preserved after a file transfer.
35 Compressed files can be restored to their original form
36 using gzip -d or gunzip or zcat. If the original name saved
37 in the compressed file is not suitable for its file system,
38 a new name is constructed from the original one to make it
41 gunzip takes a list of files on its command line and
42 replaces each file whose name ends with .gz, -gz, .z, -z, _z
43 or .Z and which begins with the correct magic number with an
44 uncompressed file without the original extension. gunzip
45 also recognizes the special extensions .tgz and .taz as
46 shorthands for .tar.gz and .tar.Z respectively. When
47 compressing, gzip uses the .tgz extension if necessary
48 instead of truncating a file with a .tar extension.
50 gunzip can currently decompress files created by gzip, zip,
51 compress, compress -H or pack. The detection of the input
52 format is automatic. When using the first two formats,
53 gunzip checks a 32 bit CRC. For pack, gunzip checks the
54 uncompressed length. The standard compress format was not
55 designed to allow consistency checks. However gunzip is
56 sometimes able to detect a bad .Z file. If you get an error
57 when uncompressing a .Z file, do not assume that the .Z file
58 is correct simply because the standard uncompress does not
59 complain. This generally means that the standard uncompress
60 does not check its input, and happily generates garbage out-
61 put. The SCO compress -H format (lzh compression method)
62 does not include a CRC but also allows some consistency
65 Files created by zip can be uncompressed by gzip only if
66 they have a single member compressed with the 'deflation'
67 method. This feature is only intended to help conversion of
68 tar.zip files to the tar.gz format. To extract zip files
69 with several members, use unzip instead of gunzip.
71 zcat is identical to gunzip -c. (On some systems, zcat may
72 be installed as gzcat to preserve the original link to
73 compress.) zcat uncompresses either a list of files on the
74 command line or its standard input and writes the
75 uncompressed data on standard output. zcat will uncompress
76 files that have the correct magic number whether they have a
79 Gzip uses the Lempel-Ziv algorithm used in zip and PKZIP.
80 The amount of compression obtained depends on the size of
81 the input and the distribution of common substrings. Typi-
82 cally, text such as source code or English is reduced by
83 60-70%. Compression is generally much better than that
84 achieved by LZW (as used in compress), Huffman coding (as
85 used in pack), or adaptive Huffman coding (compact).
87 Compression is always performed, even if the compressed file
88 is slightly larger than the original. The worst case expan-
89 sion is a few bytes for the gzip file header, plus 5 bytes
90 every 32K block, or an expansion ratio of 0.015% for large
91 files. Note that the actual number of used disk blocks
92 almost never increases. gzip preserves the mode, ownership
93 and timestamps of files when compressing or decompressing.
97 Ascii text mode: convert end-of-lines using local con-
98 ventions. This option is supported only on some non-
99 Unix systems. For MSDOS, CR LF is converted to LF when
100 compressing, and LF is converted to CR LF when
103 -c --stdout --to-stdout
104 Write output on standard output; keep original files
105 unchanged. If there are several input files, the out-
106 put consists of a sequence of independently compressed
107 members. To obtain better compression, concatenate all
108 input files before compressing them.
110 -d --decompress --uncompress
114 Force compression or decompression even if the file has
115 multiple links or the corresponding file already
116 exists, or if the compressed data is read from or writ-
117 ten to a terminal. If the input data is not in a format
118 recognized by gzip, and if the option --stdout is also
119 given, copy the input data without change to the stan-
120 dard output: let zcat behave as cat. If -f is not given,
121 and when not running in the background, gzip prompts to
122 verify whether an existing file should be overwritten.
125 Display a help screen and quit.
128 For each compressed file, list the following fields:
130 compressed size: size of the compressed file
131 uncompressed size: size of the uncompressed file
132 ratio: compression ratio (0.0% if unknown)
133 uncompressed_name: name of the uncompressed file
135 The uncompressed size is given as -1 on VMS because it
136 it is not possible to seek reliably to the end of the
137 compressed file, where this size is stored.
139 In combination with the --verbose option, the following
140 fields are also displayed:
142 method: compression method
143 crc: the 32-bit CRC of the uncompressed data
144 date & time: time stamp for the uncompressed file
146 The compression methods currently supported are
147 deflate, compress, lzh (SCO compress -H) and pack. The
148 crc is given as ffffffff on VMS for the reason given
149 above about the uncompressed size.
151 With --name, the uncompressed name, date and time are
152 those stored within the compress file if present.
154 With --verbose, the size totals and compression ratio
155 for all files is also displayed, unless some sizes are
156 unknown. With --quiet, the title and totals lines are
160 Display the gzip license and quit.
163 When compressing, do not save the original file name
164 and time stamp by default. (The original name is always
165 saved if the name had to be truncated.) When
166 decompressing, do not restore the original file name if
167 present (remove only the gzip suffix from the
168 compressed file name) and do not restore the original
169 time stamp if present (copy it from the compressed
170 file). This option is the default when decompressing.
173 When compressing, always save the original file name
174 and time stamp; this is the default. When decompress-
175 ing, restore the original file name and time stamp if
176 present. This option is useful on systems which have a
177 limit on file name length or when the time stamp has
178 been lost after a file transfer.
181 Suppress all warnings.
184 Travel the directory structure recursively. If any of
185 the file names specified on the command line are direc-
186 tories, gzip will descend into the directory and
187 compress all the files it finds there (or decompress
188 them in the case of gunzip ).
191 Use suffix suf instead of -gz. Any suffix can be
192 given, but suffixes other than -z and -gz should be
193 avoided to avoid confusion when files are transferred
194 to other. A null suffix forces gunzip to try
195 decompression on all given files regardless of suffix,
198 gunzip --suffix "" *.*
200 Previous versions of gzip used the -z suffix. This was
201 changed to avoid a conflict with pack on Unix.
204 Test. Check the compressed file integrity.
207 Verbose. Display the name and percentage reduction for
208 each file compressed or decompressed.
211 Version. Display the version number and compilation
215 Regulate the speed of compression using the specified
216 digit #, where -1 or --fast indicates the fastest
217 compression method (less compression) and -9 or --best
218 indicates the slowest compression method (best compres-
219 sion). The default compression level is -6 (that is,
220 biased towards high compression at expense of speed).
223 The environment variable GZIP_OPT can hold a set of default
224 options for gzip. These options are interpreted first and
225 can be overwritten by explicit command line parameters. For
227 define GZIP_OPT "-8 -v"
233 Exit status is normally 0; if an error occurs, exit status
234 is 1. If a warning occurs, exit status is 2.
236 Usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
237 Invalid options were specified on the command line.
238 file: not in gzip format
239 The file specified to gunzip has not been
241 file: Corrupt input. Use zcat to recover some data.
242 The compressed file has been damaged. The data up to
243 the point of failure can be recovered using
244 define /user sys$output file.recover
246 file: compressed with xx bits, can only handle yy bits
247 File was compressed (using LZW) by a program that
248 could deal with more bits than the decompress code
249 on this machine. Recompress the file with gzip,
250 which compresses better and uses less memory.
251 file: already has -gz suffix -- no change
252 The file is assumed to be already compressed.
253 Rename the file and try again.
254 file already exists; do you wish to overwrite (y or n)?
255 Respond "y" if you want the output file to be
256 replaced; "n" if not.
257 gunzip: corrupt input
258 A SIGSEGV violation was detected which usually means
259 that the input file has been corrupted.
261 Percentage of the input saved by compression.
262 (Relevant only for -v and -l.)
263 -- not a regular file or directory: ignored
264 When the input file is not a regular file or direc-
265 tory, it is left unaltered.
269 - upper case options need quotes: gzip "-V".
270 - restoration of timestamps and version numbers is not supported
271 - If a compressed file already exists, gzip -f overwrites it, it
272 does not create a new version.
273 - multi-part gzip files are not supported.
274 - gunzip does not preserve the input file format. You can use a
275 separate utility to restore the original format.
276 - gunzip and zcat can be used only if you have created the
277 links to gzip as documented in makegzip.com. Otherwise
278 you must use explicit parameters ("gzip -c" or "gzip -dc").
279 - gzip --list cannot give the uncompressed size and crc.
281 When writing compressed data to a tape, it is generally
282 necessary to pad the output with zeroes up to a block boun-
283 dary. When the data is read and the whole block is passed to
284 gunzip for decompression, gunzip detects that there is extra
285 trailing garbage after the compressed data and emits a warn-
286 ing by default. You have to use the --quiet option to
287 suppress the warning. This option can be set in the GZIP_OPT
288 environment variable as in:
292 On VMS, files in VFC record format are not correctly handled by
293 the C runtime library (the linefeed character is suppressed).
295 In some rare cases, the --best option gives worse compres-
296 sion than the default compression level (-6). On some highly
297 redundant files, compress compresses better than gzip.