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 "-", the standard input is
39 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. For example, if file names are limited
55 to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz.
56 Names are not truncated on systems which do not have a limit on file name
61 keeps the original file name and timestamp in the compressed file. These
62 are used when decompressing the file with the
64 option. This is useful when the compressed file name was truncated or
65 when the timestamp was not preserved after a file transfer.
67 Compressed files can be restored to their original form using
73 If the original name saved in the compressed file is not suitable for its
74 file system, a new name is constructed from the original one to make it
78 takes a list of files on its command line and replaces each
79 file whose name ends with .gz, -gz, .z, -z, or _z (ignoring case)
80 and which begins with the correct magic number with an uncompressed
81 file without the original extension.
83 also recognizes the special extensions
96 extension if necessary instead of truncating a file with a
101 can currently decompress files created by
108 The detection of the input format is automatic. When using
109 the first two formats,
111 checks a 32 bit CRC. For
115 checks the uncompressed length. The standard
117 format was not designed to allow consistency checks. However
119 is sometimes able to detect a bad .Z file. If you get an error
120 when uncompressing a .Z file, do not assume that the .Z file is
121 correct simply because the standard
123 does not complain. This generally means that the standard
125 does not check its input, and happily generates garbage output.
126 The SCO compress -H format (lzh compression method) does not include a CRC
127 but also allows some consistency checks.
131 can be uncompressed by gzip only if they have a single member compressed
132 with the 'deflation' method. This feature is only intended to help
133 conversion of tar.zip files to the tar.gz format. To extract a
135 file with a single member, use a command like
136 .RB ' "gunzip <foo.zip" '
138 .RB ' "gunzip -S .zip foo.zip" '.
140 with several members, use
155 to preserve the original link to
158 uncompresses either a list of files on the command line or its
159 standard input and writes the uncompressed data on standard output.
161 will uncompress files that have the correct magic number whether
169 uses the Lempel-Ziv algorithm used in
172 The amount of compression obtained depends on the size of the
173 input and the distribution of common substrings.
174 Typically, text such as source code or English
175 is reduced by 60\-70%.
176 Compression is generally much better than that achieved by
179 Huffman coding (as used in
181 or adaptive Huffman coding
184 Compression is always performed, even if the compressed file is
185 slightly larger than the original. The worst case expansion is
186 a few bytes for the gzip file header, plus 5 bytes per 32\ KiB block,
187 or an expansion ratio of 0.015% for large files. The actual
188 number of used disk blocks almost never increases.
191 normally preserves the mode and modification timestamp
192 of a file when compressing or decompressing. If you have appropriate
193 privileges, it also preserves the file's owner and group.
197 Ascii text mode: convert end-of-lines using local conventions. This option
198 is supported only on some non-Unix systems. For MSDOS, CR LF is converted
199 to LF when compressing, and LF is converted to CR LF when decompressing.
201 .B \-c --stdout --to-stdout
202 Write output on standard output; keep original files unchanged.
203 If there are several input files, the output consists of a sequence of
204 independently compressed members. To obtain better compression,
205 concatenate all input files before compressing them.
207 .B \-d --decompress --uncompress
211 Force compression or decompression even if the file has multiple links
212 or the corresponding file already exists, or if the compressed data
213 is read from or written to a terminal. If the input data is not in
214 a format recognized by
216 and if the option --stdout is also given, copy the input data without change
217 to the standard output: let
224 and when not running in the background,
226 prompts to verify whether an existing file should be overwritten.
229 Display a help screen and quit.
232 Keep (don't delete) input files during compression or decompression.
235 For each compressed file, list the following fields:
237 compressed size: size of the compressed file
238 uncompressed size: size of the uncompressed file
239 ratio: compression ratio (0.0% if unknown)
240 uncompressed_name: name of the uncompressed file
242 The uncompressed size is given as -1 for files not in gzip format,
243 such as compressed .Z files. To get the uncompressed size for such a file,
248 In combination with the --verbose option, the following fields are also
251 method: compression method
252 crc: the 32-bit CRC of the uncompressed data
253 date & time: timestamp for the uncompressed file
255 The compression methods currently supported are deflate, compress, lzh
256 (SCO compress -H) and pack. The crc is given as ffffffff for a file
259 With --name, the uncompressed name, date and time are
260 those stored within the compress file if present.
262 With --verbose, the size totals and compression ratio for all files
263 is also displayed, unless some sizes are unknown. With --quiet,
264 the title and totals lines are not displayed.
272 When compressing, do not save the original file name and timestamp by
273 default. (The original name is always saved if the name had to be
274 truncated.) When decompressing, do not restore the original file name
275 if present (remove only the
277 suffix from the compressed file name) and do not restore the original
278 timestamp if present (copy it from the compressed file). This option
279 is the default when decompressing.
282 When compressing, always save the original file name, and save
283 the seconds part of the original modification timestamp if the
284 original is a regular file and its timestamp is at least 1 (1970-01-01
285 00:00:01 UTC) and is less than 2**32 (2106-02-07 06:28:16 UTC,
286 assuming leap seconds are not counted); this
287 is the default. When decompressing, restore from the saved file name and
288 timestamp if present. This option is useful on systems which have
289 a limit on file name length or when the timestamp has been lost after
293 Suppress all warnings.
296 Travel the directory structure recursively. If any of the file names
297 specified on the command line are directories,
299 will descend into the directory and compress all the files it finds there
300 (or decompress them in the case of
304 .B \-S .suf --suffix .suf
305 When compressing, use suffix .suf instead of .gz.
306 Any non-empty suffix can be given, but suffixes
307 other than .z and .gz should be avoided to avoid confusion when files
308 are transferred to other systems.
310 When decompressing, add .suf to the beginning of the list of
311 suffixes to try, when deriving an output file name from an input file name.
314 Use synchronous output. With this option,
316 is less likely to lose data during a system crash, but it can be
320 Test. Check the compressed file integrity then quit.
323 Verbose. Display the name and percentage reduction for each file compressed
327 Version. Display the version number and compilation options then quit.
330 Regulate the speed of compression using the specified digit
336 indicates the fastest compression method (less compression)
341 indicates the slowest compression method (best compression).
342 The default compression level is
344 (that is, biased towards high compression at expense of speed).
347 When you synchronize a compressed file between two computers, this option allows rsync to transfer only files that were changed in the archive instead of the entire archive.
348 Normally, after a change is made to any file in the archive, the compression algorithm can generate a new version of the archive that does not match the previous version of the archive. In this case, rsync transfers the entire new version of the archive to the remote computer.
349 With this option, rsync can transfer only the changed files as well as a small amount of metadata that is required to update the archive structure in the area that was changed.
351 Multiple compressed files can be concatenated. In this case,
353 will extract all members at once. For example:
355 gzip -c file1 > foo.gz
356 gzip -c file2 >> foo.gz
366 In case of damage to one member of a .gz file, other members can
367 still be recovered (if the damaged member is removed). However,
368 you can get better compression by compressing all members at once:
370 cat file1 file2 | gzip > foo.gz
372 compresses better than
374 gzip -c file1 file2 > foo.gz
376 If you want to recompress concatenated files to get better compression, do:
378 gzip -cd old.gz | gzip > new.gz
380 If a compressed file consists of several members, the uncompressed
381 size and CRC reported by the --list option applies to the last member
382 only. If you need the uncompressed size for all members, you can use:
384 gzip -cd file.gz | wc -c
386 If you wish to create a single archive file with multiple members so
387 that members can later be extracted independently, use an archiver
388 such as tar or zip. GNU tar supports the -z option to invoke gzip
389 transparently. gzip is designed as a complement to tar, not as a
392 The obsolescent environment variable
394 can hold a set of default options for
396 These options are interpreted first and can be overwritten by explicit
397 command line parameters. As this can cause problems when using
398 scripts, this feature is supported only for options that are
399 reasonably likely to not cause too much harm, and
402 This feature will be removed in a future release of
405 You can use an alias or script instead. For example, if
413 and create an executable script
415 containing the following:
432 file format is specified in P. Deutsch, \s-1GZIP\s0 file format
433 specification version 4.3,
434 .BR <https://www.ietf.org/rfc/rfc1952.txt> ,
435 Internet RFC 1952 (May 1996).
438 deflation format is specified in P. Deutsch, \s-1DEFLATE\s0 Compressed
439 Data Format Specification version 1.3,
440 .BR <https://www.ietf.org/rfc/rfc1951.txt> ,
441 Internet RFC 1951 (May 1996).
443 Exit status is normally 0;
444 if an error occurs, exit status is 1. If a warning occurs, exit status is 2.
446 Usage: gzip [-cdfhklLnNrtvV19] [-S suffix] [file ...]
447 Invalid options were specified on the command line.
449 \fIfile\fP\^: not in gzip format
450 The file specified to
452 has not been compressed.
454 \fIfile\fP\^: Corrupt input. Use zcat to recover some data.
455 The compressed file has been damaged. The data up to the point of failure
456 can be recovered using
458 zcat \fIfile\fP > recover
460 \fIfile\fP\^: compressed with \fIxx\fP bits, can only handle \fIyy\fP bits
462 was compressed (using LZW) by a program that could deal with
465 than the decompress code on this machine.
466 Recompress the file with gzip, which compresses better and uses
469 \fIfile\fP\^: already has .gz suffix -- unchanged
470 The file is assumed to be already compressed.
471 Rename the file and try again.
473 \fIfile\fP already exists; do you wish to overwrite (y or n)?
474 Respond "y" if you want the output file to be replaced; "n" if not.
476 gunzip: corrupt input
477 A SIGSEGV violation was detected which usually means that the input file has
480 \fIxx.x%\fP Percentage of the input saved by compression.
486 -- not a regular file or directory: ignored
487 When the input file is not a regular file or directory,
488 (e.g. a symbolic link, socket, FIFO, device file), it is
491 -- has \fIxx\fP other links: unchanged
492 The input file has links; it is left unchanged. See
494 for more information. Use the
496 flag to force compression of multiply-linked files.
498 When writing compressed data to a tape, it is generally necessary to
499 pad the output with zeroes up to a block boundary. When the data is
500 read and the whole block is passed to
504 detects that there is extra trailing garbage after the compressed data
505 and emits a warning by default. You can use the --quiet option to
506 suppress the warning.
508 In some rare cases, the --best option gives worse compression than
509 the default compression level (-6). On some highly redundant files,
511 compresses better than
514 Report bugs to: bug\-gzip@gnu.org
516 GNU gzip home page: <https://www.gnu.org/software/gzip/>
518 General help using GNU software: <https://www.gnu.org/gethelp/>
519 .SH "COPYRIGHT NOTICE"
520 Copyright \(co 1998-1999, 2001-2002, 2012, 2015-2022 Free Software Foundation,
523 Copyright \(co 1992, 1993 Jean-loup Gailly
525 Permission is granted to make and distribute verbatim copies of
526 this manual provided the copyright notice and this permission notice
527 are preserved on all copies.
529 Permission is granted to process this file through troff and print the
530 results, provided the printed document carries copying permission
531 notice identical to this one except for the removal of this paragraph
532 (this paragraph not being relevant to the printed manual).
535 Permission is granted to copy and distribute modified versions of this
536 manual under the conditions for verbatim copying, provided that the entire
537 resulting derived work is distributed under the terms of a permission
538 notice identical to this one.
540 Permission is granted to copy and distribute translations of this manual
541 into another language, under the above conditions for modified versions,
542 except that this permission notice may be stated in a translation approved