3 gzip, gunzip, zcat \- compress or expand files
7 .RB [ " \-acdfhlLnNrtvV19 " ]
15 .RB [ " \-acfhlLnNrtvV " ]
28 reduces the size of the named files using Lempel-Ziv coding (LZ77).
30 each file is replaced by one with the extension
32 while keeping the same ownership modes, access and modification times.
33 (The default extension is
37 for MSDOS, OS/2 FAT, Windows NT FAT and Atari.)
38 If no files are specified, or if a file name is "-", the standard input is
39 compressed to the standard output.
41 will only attempt to compress regular files.
42 In particular, it will ignore symbolic links.
44 If the compressed file name is too long for its file system,
48 attempts to truncate only the parts of the file name longer than 3 characters.
49 (A part is delimited by dots.) If the name consists of small parts only,
50 the longest parts are truncated. For example, if file names are limited
51 to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz.
52 Names are not truncated on systems which do not have a limit on file name
57 keeps the original file name and timestamp in the compressed file. These
58 are used when decompressing the file with the
60 option. This is useful when the compressed file name was truncated or
61 when the time stamp was not preserved after a file transfer.
63 Compressed files can be restored to their original form using
69 If the original name saved in the compressed file is not suitable for its
70 file system, a new name is constructed from the original one to make it
74 takes a list of files on its command line and replaces each
75 file whose name ends with .gz, -gz, .z, -z, or _z (ignoring case)
76 and which begins with the correct magic number with an uncompressed
77 file without the original extension.
79 also recognizes the special extensions
92 extension if necessary instead of truncating a file with a
97 can currently decompress files created by
98 .I gzip, zip, compress, compress -H
101 The detection of the input format is automatic. When using
102 the first two formats,
104 checks a 32 bit CRC. For
106 checks the uncompressed length. The standard
108 format was not designed to allow consistency checks. However
110 is sometimes able to detect a bad .Z file. If you get an error
111 when uncompressing a .Z file, do not assume that the .Z file is
112 correct simply because the standard
114 does not complain. This generally means that the standard
116 does not check its input, and happily generates garbage output.
117 The SCO compress -H format (lzh compression method) does not include a CRC
118 but also allows some consistency checks.
122 can be uncompressed by gzip only if they have a single member compressed
123 with the 'deflation' method. This feature is only intended to help
124 conversion of tar.zip files to the tar.gz format. To extract a
126 file with a single member, use a command like
129 .IR "gunzip -S .zip foo.zip" .
131 with several members, use
144 to preserve the original link to
147 uncompresses either a list of files on the command line or its
148 standard input and writes the uncompressed data on standard output.
150 will uncompress files that have the correct magic number whether
156 uses the Lempel-Ziv algorithm used in
159 The amount of compression obtained depends on the size of the
160 input and the distribution of common substrings.
161 Typically, text such as source code or English
162 is reduced by 60\-70%.
163 Compression is generally much better than that achieved by
166 Huffman coding (as used in
168 or adaptive Huffman coding
171 Compression is always performed, even if the compressed file is
172 slightly larger than the original. The worst case expansion is
173 a few bytes for the gzip file header, plus 5 bytes every 32K block,
174 or an expansion ratio of 0.015% for large files. Note that the actual
175 number of used disk blocks almost never increases.
177 preserves the mode, ownership and timestamps of files when compressing
182 file format is specified in P. Deutsch, \s-1GZIP\s0 file format
183 specification version 4.3, <ftp://ftp.isi.edu/in-notes/rfc1952.txt>,
184 Internet RFC 1952 (May 1996). The
186 deflation format is specified in P. Deutsch, \s-1DEFLATE\s0 Compressed
187 Data Format Specification version 1.3,
188 <ftp://ftp.isi.edu/in-notes/rfc1951.txt>, Internet RFC 1951 (May 1996).
193 Ascii text mode: convert end-of-lines using local conventions. This option
194 is supported only on some non-Unix systems. For MSDOS, CR LF is converted
195 to LF when compressing, and LF is converted to CR LF when decompressing.
197 .B \-c --stdout --to-stdout
198 Write output on standard output; keep original files unchanged.
199 If there are several input files, the output consists of a sequence of
200 independently compressed members. To obtain better compression,
201 concatenate all input files before compressing them.
203 .B \-d --decompress --uncompress
207 Force compression or decompression even if the file has multiple links
208 or the corresponding file already exists, or if the compressed data
209 is read from or written to a terminal. If the input data is not in
210 a format recognized by
212 and if the option --stdout is also given, copy the input data without change
213 to the standard output: let
220 and when not running in the background,
222 prompts to verify whether an existing file should be overwritten.
225 Display a help screen and quit.
228 For each compressed file, list the following fields:
230 compressed size: size of the compressed file
231 uncompressed size: size of the uncompressed file
232 ratio: compression ratio (0.0% if unknown)
233 uncompressed_name: name of the uncompressed file
235 The uncompressed size is given as -1 for files not in gzip format,
236 such as compressed .Z files. To get the uncompressed size for such a file,
241 In combination with the --verbose option, the following fields are also
244 method: compression method
245 crc: the 32-bit CRC of the uncompressed data
246 date & time: time stamp for the uncompressed file
248 The compression methods currently supported are deflate, compress, lzh
249 (SCO compress -H) and pack. The crc is given as ffffffff for a file
252 With --name, the uncompressed name, date and time are
253 those stored within the compress file if present.
255 With --verbose, the size totals and compression ratio for all files
256 is also displayed, unless some sizes are unknown. With --quiet,
257 the title and totals lines are not displayed.
265 When compressing, do not save the original file name and time stamp by
266 default. (The original name is always saved if the name had to be
267 truncated.) When decompressing, do not restore the original file name
268 if present (remove only the
270 suffix from the compressed file name) and do not restore the original
271 time stamp if present (copy it from the compressed file). This option
272 is the default when decompressing.
275 When compressing, always save the original file name and time stamp; this
276 is the default. When decompressing, restore the original file name and
277 time stamp if present. This option is useful on systems which have
278 a limit on file name length or when the time stamp has been lost after
282 Suppress all warnings.
285 Travel the directory structure recursively. If any of the file names
286 specified on the command line are directories,
288 will descend into the directory and compress all the files it finds there
289 (or decompress them in the case of
293 .B \-S .suf --suffix .suf
294 Use suffix .suf instead of .gz. Any suffix can be given, but suffixes
295 other than .z and .gz should be avoided to avoid confusion when files
296 are transferred to other systems. A null suffix forces gunzip to try
297 decompression on all given files regardless of suffix, as in:
299 gunzip -S "" * (*.* for MSDOS)
301 Previous versions of gzip used
302 the .z suffix. This was changed to avoid a conflict with
306 Test. Check the compressed file integrity.
309 Verbose. Display the name and percentage reduction for each file compressed
313 Version. Display the version number and compilation options then quit.
316 Regulate the speed of compression using the specified digit
322 indicates the fastest compression method (less compression)
327 indicates the slowest compression method (best compression).
328 The default compression level is
330 (that is, biased towards high compression at expense of speed).
332 Multiple compressed files can be concatenated. In this case,
334 will extract all members at once. For example:
336 gzip -c file1 > foo.gz
337 gzip -c file2 >> foo.gz
347 In case of damage to one member of a .gz file, other members can
348 still be recovered (if the damaged member is removed). However,
349 you can get better compression by compressing all members at once:
351 cat file1 file2 | gzip > foo.gz
353 compresses better than
355 gzip -c file1 file2 > foo.gz
357 If you want to recompress concatenated files to get better compression, do:
359 gzip -cd old.gz | gzip > new.gz
361 If a compressed file consists of several members, the uncompressed
362 size and CRC reported by the --list option applies to the last member
363 only. If you need the uncompressed size for all members, you can use:
365 gzip -cd file.gz | wc -c
367 If you wish to create a single archive file with multiple members so
368 that members can later be extracted independently, use an archiver
369 such as tar or zip. GNU tar supports the -z option to invoke gzip
370 transparently. gzip is designed as a complement to tar, not as a
373 The environment variable
375 can hold a set of default options for
377 These options are interpreted first and can be overwritten by
378 explicit command line parameters. For example:
379 for sh: GZIP="-8v --name"; export GZIP
380 for csh: setenv GZIP "-8v --name"
381 for MSDOS: set GZIP=-8v --name
383 On Vax/VMS, the name of the environment variable is GZIP_OPT, to
384 avoid a conflict with the symbol set for invocation of the program.
386 znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), zip(1), unzip(1), compress(1),
391 file format is specified in P. Deutsch, \s-1GZIP\s0 file format
392 specification version 4.3,
393 .BR <ftp://ftp.isi.edu/in-notes/rfc1952.txt> ,
394 Internet RFC 1952 (May 1996).
397 deflation format is specified in P. Deutsch, \s-1DEFLATE\s0 Compressed
398 Data Format Specification version 1.3,
399 .BR <ftp://ftp.isi.edu/in-notes/rfc1951.txt> ,
400 Internet RFC 1951 (May 1996).
402 Exit status is normally 0;
403 if an error occurs, exit status is 1. If a warning occurs, exit status is 2.
405 Usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
406 Invalid options were specified on the command line.
408 \fIfile\fP\^: not in gzip format
409 The file specified to
411 has not been compressed.
413 \fIfile\fP\^: Corrupt input. Use zcat to recover some data.
414 The compressed file has been damaged. The data up to the point of failure
415 can be recovered using
417 zcat \fIfile\fP > recover
419 \fIfile\fP\^: compressed with \fIxx\fP bits, can only handle \fIyy\fP bits
421 was compressed (using LZW) by a program that could deal with
424 than the decompress code on this machine.
425 Recompress the file with gzip, which compresses better and uses
428 \fIfile\fP\^: already has .gz suffix -- no change
429 The file is assumed to be already compressed.
430 Rename the file and try again.
432 \fIfile\fP already exists; do you wish to overwrite (y or n)?
433 Respond "y" if you want the output file to be replaced; "n" if not.
435 gunzip: corrupt input
436 A SIGSEGV violation was detected which usually means that the input file has
439 \fIxx.x%\fP Percentage of the input saved by compression.
445 -- not a regular file or directory: ignored
446 When the input file is not a regular file or directory,
447 (e.g. a symbolic link, socket, FIFO, device file), it is
450 -- has \fIxx\fP other links: unchanged
451 The input file has links; it is left unchanged. See
453 for more information. Use the
455 flag to force compression of multiply-linked files.
457 When writing compressed data to a tape, it is generally necessary to
458 pad the output with zeroes up to a block boundary. When the data is
459 read and the whole block is passed to
463 detects that there is extra trailing garbage after the compressed data
464 and emits a warning by default. You have to use the --quiet option to
465 suppress the warning. This option can be set in the
467 environment variable as in:
468 for sh: GZIP="-q" tar -xfz --block-compress /dev/rst0
469 for csh: (setenv GZIP -q; tar -xfz --block-compr /dev/rst0
471 In the above example, gzip is invoked implicitly by the -z option of
472 GNU tar. Make sure that the same block size (-b option of tar) is used
473 for reading and writing compressed data on tapes. (This example
474 assumes you are using the GNU version of tar.)
476 The gzip format represents the input size modulo 2^32, so the
477 --list option reports incorrect uncompressed sizes and compression
478 ratios for uncompressed files 4 GB and larger. To work around this
479 problem, you can use the following command to discover a large
480 uncompressed file's true size:
484 The --list option reports sizes as -1 and crc as ffffffff if the
485 compressed file is on a non seekable media.
487 In some rare cases, the --best option gives worse compression than
488 the default compression level (-6). On some highly redundant files,
490 compresses better than
492 .SH "COPYRIGHT NOTICE"
493 Copyright \(co 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
495 Copyright \(co 1992, 1993 Jean-loup Gailly
497 Permission is granted to make and distribute verbatim copies of
498 this manual provided the copyright notice and this permission notice
499 are preserved on all copies.
501 Permission is granted to process this file through troff and print the
502 results, provided the printed document carries copying permission
503 notice identical to this one except for the removal of this paragraph
504 (this paragraph not being relevant to the printed manual).
507 Permission is granted to copy and distribute modified versions of this
508 manual under the conditions for verbatim copying, provided that the entire
509 resulting derived work is distributed under the terms of a permission
510 notice identical to this one.
512 Permission is granted to copy and distribute translations of this manual
513 into another language, under the above conditions for modified versions,
514 except that this permission notice may be stated in a translation approved