3 gzip, gunzip, zcat \- compress or expand files
7 .RB [ " \-acdfhklLnNrtvV19 " ]
15 .RB [ " \-acfhklLnNrtvV " ]
30 reduces the size of the named files using Lempel-Ziv coding (LZ77).
32 each file is replaced by one with the extension
34 while keeping the same ownership modes, access and modification times.
35 (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 "\-",
39 the standard input is compressed to the standard output.
43 will only attempt to compress regular files.
44 In particular, it will ignore symbolic links.
46 If the compressed file name is too long for its file system,
52 attempts to truncate only the parts of the file name longer than 3 characters.
53 (A part is delimited by dots.) If the name consists of small parts only,
54 the longest parts are truncated.
55 For example, if file names are limited to 14 characters,
56 gzip.msdos.exe is compressed to gzi.msd.exe.gz.
57 Names are not truncated on systems which do not have a limit on file name
62 keeps the original file name and timestamp in the compressed file.
63 These are used when decompressing the file with the
66 This is useful when the compressed file name was truncated or
67 when the timestamp was not preserved after a file transfer.
69 Compressed files can be restored to their original form using
75 If the original name saved in the compressed file is not suitable for its
76 file system, a new name is constructed from the original one to make it valid.
79 takes a list of files on its command line and replaces each
80 file whose name ends with .gz, \-gz, .z, \-z, or _z (ignoring case)
81 and which begins with the correct magic number with an uncompressed
82 file without the original extension.
84 also recognizes the special extensions
97 extension if necessary instead of truncating a file with a
102 can currently decompress files created by
109 The detection of the input format is automatic.
110 When using the first two formats,
117 checks the uncompressed length.
120 format was not designed to allow consistency checks.
123 is sometimes able to detect a bad .Z file.
124 If you get an error when uncompressing a .Z file,
125 do not assume that the .Z file is
126 correct simply because the standard
129 This generally means that the standard
131 does not check its input, and happily generates garbage output.
132 The SCO compress \-H format (lzh compression method) does not include a CRC
133 but also allows some consistency checks.
137 can be uncompressed by gzip only if they have a single member compressed
138 with the 'deflation' method.
139 This feature is only intended to help
140 conversion of tar.zip files to the tar.gz format.
143 file with a single member, use a command like
144 .RB ' "gunzip <foo.zip" '
146 .RB ' "gunzip \-S .zip foo.zip" '.
148 with several members, use
163 to preserve the original link to
166 uncompresses either a list of files on the command line or its
167 standard input and writes the uncompressed data on standard output.
169 will uncompress files that have the correct magic number whether
177 uses the Lempel-Ziv algorithm used in
180 The amount of compression obtained depends on the size of the
181 input and the distribution of common substrings.
182 Typically, text such as source code or English
183 is reduced by 60\(en70%.
184 Compression is generally much better than that achieved by
187 Huffman coding (as used in
189 or adaptive Huffman coding
192 Compression is always performed, even if the compressed file is
193 slightly larger than the original.
194 The worst case expansion is
195 a few bytes for the gzip file header, plus 5 bytes per 32\ KiB block,
196 or an expansion ratio of 0.015% for large files.
197 The actual number of used disk blocks almost never increases.
200 normally preserves the mode and modification timestamp
201 of a file when compressing or decompressing.
202 If you have appropriate privileges,
203 it also preserves the file's owner and group.
207 Ascii text mode: convert end-of-lines using local conventions.
208 This option is supported only on some non-Unix systems.
209 For MSDOS, CR LF is converted to LF when compressing,
210 and LF is converted to CR LF when decompressing.
212 .B \-c \-\-stdout \-\-to-stdout
213 Write output on standard output; keep original files unchanged.
214 If there are several input files, the output consists of a sequence of
215 independently compressed members.
216 To obtain better compression,
217 concatenate all input files before compressing them.
219 .B \-d \-\-decompress \-\-uncompress
223 Force compression or decompression even if the file has multiple links
224 or the corresponding file already exists, or if the compressed data
225 is read from or written to a terminal.
226 If the input data is not in a format recognized by
228 and if the option \-\-stdout is also given, copy the input data without change
229 to the standard output: let
236 and when not running in the background,
238 prompts to verify whether an existing file should be overwritten.
241 Display a help screen and quit.
244 Keep (don't delete) input files during compression or decompression.
247 For each compressed file, list the following fields:
249 compressed size: size of the compressed file
250 uncompressed size: size of the uncompressed file
251 ratio: compression ratio (0.0% if unknown)
252 uncompressed_name: name of the uncompressed file
254 The uncompressed size is given as \-1 for files not in gzip format,
255 such as compressed .Z files.
256 To get the uncompressed size for such a file, you can use:
260 In combination with the \-\-verbose option, the following fields are also
263 method: compression method
264 crc: the 32-bit CRC of the uncompressed data
265 date & time: timestamp for the uncompressed file
267 The compression methods currently supported are deflate, compress, lzh
268 (SCO compress \-H) and pack.
269 The crc is given as ffffffff for a file not in gzip format.
271 With \-\-name, the uncompressed name, date and time are
272 those stored within the compress file if present.
274 With \-\-verbose, the size totals and compression ratio for all files
275 is also displayed, unless some sizes are unknown.
276 With \-\-quiet, the title and totals lines are not displayed.
284 When compressing, do not save the original file name and timestamp by default.
285 (The original name is always saved if the name had to be truncated.)
286 When decompressing, do not restore the original file name
287 if present (remove only the
289 suffix from the compressed file name) and do not restore the original
290 timestamp if present (copy it from the compressed file).
291 This option is the default when decompressing.
294 When compressing, always save the original file name, and save
295 the seconds part of the original modification timestamp if the
296 original is a regular file and its timestamp is at least 1 (1970-01-01
297 00:00:01 UTC) and is less than 2**32 (2106-02-07 06:28:16 UTC,
298 assuming leap seconds are not counted); this
300 When decompressing, restore from the saved file name and
301 timestamp if present.
302 This option is useful on systems which have a limit on file name
303 length or when the timestamp has been lost after a file transfer.
306 Suppress all warnings.
309 Travel the directory structure recursively.
310 If any of the file names specified on the command line are directories,
312 will descend into the directory and compress all the files it finds there
313 (or decompress them in the case of
317 .B \-S .suf \-\-suffix .suf
318 When compressing, use suffix .suf instead of .gz.
319 Although any non-empty suffix can be given so long as it does not contain "/",
320 suffixes other than .z and .gz should be avoided to avoid confusion when files
321 are transferred to other systems.
323 When decompressing, add .suf to the beginning of the list of
324 suffixes to try, when deriving an output file name from an input file name.
327 Use synchronous output.
330 is less likely to lose data during a system crash, but it can be
335 Check the compressed file integrity then quit.
339 Display the name and percentage reduction for each file compressed
344 Display the version number and compilation options then quit.
346 .B \-# \-\-fast \-\-best
347 Regulate the speed of compression using the specified digit
353 indicates the fastest compression method (less compression)
358 indicates the slowest compression method (best compression).
359 The default compression level is
361 (that is, biased towards high compression at expense of speed).
364 When you synchronize a compressed file between two computers,
365 this option allows rsync to transfer only files that were changed in
366 the archive instead of the entire archive.
367 Normally, after a change is made to any file in the archive,
368 the compression algorithm can generate a new version of the archive
369 that does not match the previous version of the archive.
370 In this case, rsync transfers the entire new version of the archive to
372 With this option, rsync can transfer only the changed files as well as
373 a small amount of metadata that is required to update the archive
374 structure in the area that was changed.
376 Multiple compressed files can be concatenated.
379 will extract all members at once.
382 gzip \-c file1 > foo.gz
383 gzip \-c file2 >> foo.gz
393 In case of damage to one member of a .gz file, other members can
394 still be recovered (if the damaged member is removed).
395 However, you can get better compression by compressing all members at once:
397 cat file1 file2 | gzip > foo.gz
399 compresses better than
401 gzip \-c file1 file2 > foo.gz
403 If you want to recompress concatenated files to get better compression, do:
405 gzip \-cd old.gz | gzip > new.gz
407 If a compressed file consists of several members, the uncompressed
408 size and CRC reported by the \-\-list option applies to the last member only.
409 If you need the uncompressed size for all members, you can use:
411 gzip \-cd file.gz | wc \-c
413 If you wish to create a single archive file with multiple members so
414 that members can later be extracted independently, use an archiver
416 GNU tar supports the \-z option to invoke gzip transparently.
417 gzip is designed as a complement to tar, not as a replacement.
419 The obsolescent environment variable
421 can hold a set of default options for
423 These options are interpreted first and can be overwritten by explicit
424 command line parameters.
425 As this can cause problems when using scripts,
426 this feature is supported only for options that are
427 reasonably likely to not cause too much harm, and
430 This feature will be removed in a future release of
433 You can use an alias or script instead.
442 and create an executable script
444 containing the following:
461 file format is specified in P. Deutsch, \s-1GZIP\s0 file format
462 specification version 4.3,
463 .BR <https://www.ietf.org/rfc/rfc1952.txt> ,
464 Internet RFC 1952 (May 1996).
467 deflation format is specified in P. Deutsch, \s-1DEFLATE\s0 Compressed
468 Data Format Specification version 1.3,
469 .BR <https://www.ietf.org/rfc/rfc1951.txt> ,
470 Internet RFC 1951 (May 1996).
472 Exit status is normally 0;
473 if an error occurs, exit status is 1.
474 If a warning occurs, exit status is 2.
476 Usage: gzip [\-cdfhklLnNrtvV19] [\-S suffix] [file ...]
477 Invalid options were specified on the command line.
479 \fIfile\fP\^: not in gzip format
480 The file specified to
482 has not been compressed.
484 \fIfile\fP\^: Corrupt input.
485 Use zcat to recover some data.
486 The compressed file has been damaged.
487 The data up to the point of failure can be recovered using
489 zcat \fIfile\fP > recover
491 \fIfile\fP\^: compressed with \fIxx\fP bits, can only handle \fIyy\fP bits
493 was compressed (using LZW) by a program that could deal with
496 than the decompress code on this machine.
497 Recompress the file with gzip, which compresses better and uses
500 \fIfile\fP\^: already has .gz suffix \-\- unchanged
501 The file is assumed to be already compressed.
502 Rename the file and try again.
504 \fIfile\fP already exists; do you wish to overwrite (y or n)?
505 Respond "y" if you want the output file to be replaced; "n" if not.
507 gunzip: corrupt input
508 A SIGSEGV violation was detected which usually means that the input file has
511 \fIxx.x%\fP Percentage of the input saved by compression.
517 \-\- not a regular file or directory: ignored
518 When the input file is not a regular file or directory,
519 (e.g., a symbolic link, socket, FIFO, device file), it is
522 \-\- has \fIxx\fP other links: unchanged
523 The input file has links; it is left unchanged.
526 for more information.
529 flag to force compression of multiply-linked files.
531 When writing compressed data to a tape, it is generally necessary to
532 pad the output with zeroes up to a block boundary.
533 When the data is read and the whole block is passed to
537 detects that there is extra trailing garbage after the compressed data
538 and emits a warning by default.
539 You can use the \-\-quiet option to suppress the warning.
541 In some rare cases, the \-\-best option gives worse compression than
542 the default compression level (\-6).
543 On some highly redundant files,
545 compresses better than
548 Report bugs to: bug\-gzip@gnu.org
550 GNU gzip home page: <https://www.gnu.org/software/gzip/>
552 General help using GNU software: <https://www.gnu.org/gethelp/>
553 .SH "COPYRIGHT NOTICE"
554 Copyright \(co 1998\(en1999, 2001\(en2002, 2012, 2015\(en2024 Free Software
557 Copyright \(co 1992, 1993 Jean-loup Gailly
559 Permission is granted to make and distribute verbatim copies of
560 this manual provided the copyright notice and this permission notice
561 are preserved on all copies.
563 Permission is granted to process this file through troff and print the
564 results, provided the printed document carries copying permission
565 notice identical to this one except for the removal of this paragraph
566 (this paragraph not being relevant to the printed manual).
569 Permission is granted to copy and distribute modified versions of this
570 manual under the conditions for verbatim copying, provided that the entire
571 resulting derived work is distributed under the terms of a permission
572 notice identical to this one.
574 Permission is granted to copy and distribute translations of this manual
575 into another language, under the above conditions for modified versions,
576 except that this permission notice may be stated in a translation approved