fix typo in man page
[debian/gzip] / gzip.1
1 .TH GZIP 1 local
2 .SH NAME
3 gzip, gunzip, zcat \- compress or expand files
4 .SH SYNOPSIS
5 .ll +8
6 .B gzip
7 .RB [ " \-acdfhklLnNrtvV19 " ]
8 .RB [ --rsyncable ]
9 .RB [ \-S\ suffix ]
10 [
11 .I "name \&..."
12 ]
13 .ll -8
14 .br
15 .B gunzip
16 .RB [ " \-acfhklLnNrtvV " ]
17 .RB [ \-S\ suffix ]
18 [
19 .I "name \&..."
20 ]
21 .br
22 .B zcat
23 .RB [ " \-fhLV " ]
24 [
25 .I "name \&..."
26 ]
27 .SH DESCRIPTION
28 .I Gzip
29 reduces the size of the named files using Lempel-Ziv coding (LZ77).
30 Whenever possible,
31 each file is replaced by one with the extension
32 .BR "\&.gz" ,
33 while keeping the same ownership modes, access and modification times.
34 (The default extension is
35 .B "\-gz"
36 for VMS,
37 .B "z"
38 for MSDOS, OS/2 FAT, Windows NT FAT and Atari.)
39 If no files are specified, or if a file name is "-", the standard input is
40 compressed to the standard output.
41 .I Gzip
42 will only attempt to compress regular files.
43 In particular, it will ignore symbolic links.
44 .PP
45 If the compressed file name is too long for its file system,
46 .I gzip
47 truncates it.
48 .I Gzip
49 attempts to truncate only the parts of the file name longer than 3 characters.
50 (A part is delimited by dots.) If the name consists of small parts only,
51 the longest parts are truncated. For example, if file names are limited
52 to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz.
53 Names are not truncated on systems which do not have a limit on file name
54 length.
55 .PP
56 By default,
57 .I gzip
58 keeps the original file name and timestamp in the compressed file. These
59 are used when decompressing the file with the
60 .B \-N
61 option. This is useful when the compressed file name was truncated or
62 when the time stamp was not preserved after a file transfer.
63 .PP
64 Compressed files can be restored to their original form using
65 .I gzip -d
66 or
67 .I gunzip
68 or
69 .IR zcat .
70 If the original name saved in the compressed file is not suitable for its
71 file system, a new name is constructed from the original one to make it
72 legal.
73 .PP
74 .I gunzip
75 takes a list of files on its command line and replaces each
76 file whose name ends with .gz, -gz, .z, -z, or _z (ignoring case)
77 and which begins with the correct magic number with an uncompressed
78 file without the original extension.
79 .I gunzip
80 also recognizes the special extensions
81 .B "\&.tgz"
82 and
83 .B "\&.taz"
84 as shorthands for
85 .B "\&.tar.gz"
86 and
87 .B "\&.tar.Z"
88 respectively.
89 When compressing,
90 .I gzip
91 uses the
92 .B "\&.tgz"
93 extension if necessary instead of truncating a file with a
94 .B "\&.tar"
95 extension.
96 .PP
97 .I gunzip
98 can currently decompress files created by
99 .IR gzip ,
100 .IR zip ,
101 .IR compress ,
102 .I "compress -H"
103 or
104 .IR pack .
105 The detection of the input format is automatic.  When using
106 the first two formats,
107 .I gunzip
108 checks a 32 bit CRC. For
109 .I pack
110 and
111 .I gunzip
112 checks the uncompressed length. The standard
113 .I compress
114 format was not designed to allow consistency checks. However
115 .I gunzip
116 is sometimes able to detect a bad .Z file. If you get an error
117 when uncompressing a .Z file, do not assume that the .Z file is
118 correct simply because the standard
119 .I uncompress
120 does not complain. This generally means that the standard
121 .I uncompress
122 does not check its input, and happily generates garbage output.
123 The SCO compress -H format (lzh compression method) does not include a CRC
124 but also allows some consistency checks.
125 .PP
126 Files created by
127 .I zip
128 can be uncompressed by gzip only if they have a single member compressed
129 with the 'deflation' method. This feature is only intended to help
130 conversion of tar.zip files to the tar.gz format.  To extract a
131 .I zip
132 file with a single member, use a command like
133 .I "gunzip <foo.zip"
134 or
135 .IR "gunzip -S .zip foo.zip" .
136 To extract zip files
137 with several members, use
138 .I unzip
139 instead of
140 .IR gunzip .
141 .PP
142 .I zcat
143 is identical to
144 .I gunzip
145 .BR \-c .
146 (On some systems,
147 .I zcat
148 may be installed as
149 .I gzcat
150 to preserve the original link to
151 .IR compress .)
152 .I zcat
153 uncompresses either a list of files on the command line or its
154 standard input and writes the uncompressed data on standard output.
155 .I zcat
156 will uncompress files that have the correct magic number whether
157 they have a
158 .B "\&.gz"
159 suffix or not.
160 .PP
161 .I Gzip
162 uses the Lempel-Ziv algorithm used in
163 .I zip
164 and PKZIP.
165 The amount of compression obtained depends on the size of the
166 input and the distribution of common substrings.
167 Typically, text such as source code or English
168 is reduced by 60\-70%.
169 Compression is generally much better than that achieved by
170 LZW (as used in
171 .IR compress ),
172 Huffman coding (as used in
173 .IR pack ),
174 or adaptive Huffman coding
175 .RI ( compact ).
176 .PP
177 Compression is always performed, even if the compressed file is
178 slightly larger than the original. The worst case expansion is
179 a few bytes for the gzip file header, plus 5 bytes every 32K block,
180 or an expansion ratio of 0.015% for large files. Note that the actual
181 number of used disk blocks almost never increases.
182 .I gzip
183 preserves the mode, ownership and timestamps of files when compressing
184 or decompressing.
185 .SH OPTIONS
186 .TP
187 .B \-a --ascii
188 Ascii text mode: convert end-of-lines using local conventions. This option
189 is supported only on some non-Unix systems. For MSDOS, CR LF is converted
190 to LF when compressing, and LF is converted to CR LF when decompressing.
191 .TP
192 .B \-c --stdout --to-stdout
193 Write output on standard output; keep original files unchanged.
194 If there are several input files, the output consists of a sequence of
195 independently compressed members. To obtain better compression,
196 concatenate all input files before compressing them.
197 .TP
198 .B \-d --decompress --uncompress
199 Decompress.
200 .TP
201 .B \-f --force
202 Force compression or decompression even if the file has multiple links
203 or the corresponding file already exists, or if the compressed data
204 is read from or written to a terminal. If the input data is not in
205 a format recognized by
206 .IR gzip ,
207 and if the option --stdout is also given, copy the input data without change
208 to the standard output: let
209 .I zcat
210 behave as
211 .IR cat .
212 If
213 .B \-f
214 is not given,
215 and when not running in the background,
216 .I gzip
217 prompts to verify whether an existing file should be overwritten.
218 .TP
219 .B \-h --help
220 Display a help screen and quit.
221 .TP
222 .B \-k --keep
223 Keep (don't delete) input files during compression or decompression.
224 .TP
225 .B \-l --list
226 For each compressed file, list the following fields:
227
228     compressed size: size of the compressed file
229     uncompressed size: size of the uncompressed file
230     ratio: compression ratio (0.0% if unknown)
231     uncompressed_name: name of the uncompressed file
232
233 The uncompressed size is given as -1 for files not in gzip format,
234 such as compressed .Z files. To get the uncompressed size for such a file,
235 you can use:
236
237     zcat file.Z | wc -c
238
239 In combination with the --verbose option, the following fields are also
240 displayed:
241
242     method: compression method
243     crc: the 32-bit CRC of the uncompressed data
244     date & time: time stamp for the uncompressed file
245
246 The compression methods currently supported are deflate, compress, lzh
247 (SCO compress -H) and pack.  The crc is given as ffffffff for a file
248 not in gzip format.
249
250 With --name, the uncompressed name,  date and time  are
251 those stored within the compress file if present.
252
253 With --verbose, the size totals and compression ratio for all files
254 is also displayed, unless some sizes are unknown. With --quiet,
255 the title and totals lines are not displayed.
256 .TP
257 .B \-L --license
258 Display the
259 .I gzip
260 license and quit.
261 .TP
262 .B \-n --no-name
263 When compressing, do not save the original file name and time stamp by
264 default. (The original name is always saved if the name had to be
265 truncated.) When decompressing, do not restore the original file name
266 if present (remove only the
267 .I gzip
268 suffix from the compressed file name) and do not restore the original
269 time stamp if present (copy it from the compressed file). This option
270 is the default when decompressing.
271 .TP
272 .B \-N --name
273 When compressing, always save the original file name and time stamp; this
274 is the default. When decompressing, restore the original file name and
275 time stamp if present. This option is useful on systems which have
276 a limit on file name length or when the time stamp has been lost after
277 a file transfer.
278 .TP
279 .B \-q --quiet
280 Suppress all warnings.
281 .TP
282 .B \-r --recursive
283 Travel the directory structure recursively. If any of the file names
284 specified on the command line are directories,
285 .I gzip
286 will descend into the directory and compress all the files it finds there
287 (or decompress them in the case of
288 .I gunzip
289 ).
290 .TP
291 .B --rsyncable
292 While compressing, synchronize the output occasionally based on the input.
293 This increases size by less than 1 percent most cases, but means that the
294 .BR rsync (1)
295 program can take advantage of similarities in the uncompressed input
296 when synchronizing two files compressed with this flag.
297 .I gunzip
298 cannot tell the difference between a compressed file created with this option,
299 and one created without it.
300 .TP
301 .B \-S .suf   --suffix .suf
302 When compressing, use suffix .suf instead of .gz.
303 Any non-empty suffix can be given, but suffixes
304 other than .z and .gz should be avoided to avoid confusion when files
305 are transferred to other systems.
306
307 When decompressing, add .suf to the beginning of the list of
308 suffixes to try, when deriving an output file name from an input file name.
309 .TP
310 .B \-t --test
311 Test. Check the compressed file integrity.
312 .TP
313 .B \-v --verbose
314 Verbose. Display the name and percentage reduction for each file compressed
315 or decompressed.
316 .TP
317 .B \-V --version
318 Version. Display the version number and compilation options then quit.
319 .TP
320 .B \-# --fast --best
321 Regulate the speed of compression using the specified digit
322 .IR # ,
323 where
324 .B \-1
325 or
326 .B \-\-fast
327 indicates the fastest compression method (less compression)
328 and
329 .B \-9
330 or
331 .B \-\-best
332 indicates the slowest compression method (best compression).
333 The default compression level is
334 .BR \-6
335 (that is, biased towards high compression at expense of speed).
336 .SH "ADVANCED USAGE"
337 Multiple compressed files can be concatenated. In this case,
338 .I gunzip
339 will extract all members at once. For example:
340
341       gzip -c file1  > foo.gz
342       gzip -c file2 >> foo.gz
343
344 Then
345
346       gunzip -c foo
347
348 is equivalent to
349
350       cat file1 file2
351
352 In case of damage to one member of a .gz file, other members can
353 still be recovered (if the damaged member is removed). However,
354 you can get better compression by compressing all members at once:
355
356       cat file1 file2 | gzip > foo.gz
357
358 compresses better than
359
360       gzip -c file1 file2 > foo.gz
361
362 If you want to recompress concatenated files to get better compression, do:
363
364       gzip -cd old.gz | gzip > new.gz
365
366 If a compressed file consists of several members, the uncompressed
367 size and CRC reported by the --list option applies to the last member
368 only. If you need the uncompressed size for all members, you can use:
369
370       gzip -cd file.gz | wc -c
371
372 If you wish to create a single archive file with multiple members so
373 that members can later be extracted independently, use an archiver
374 such as tar or zip. GNU tar supports the -z option to invoke gzip
375 transparently. gzip is designed as a complement to tar, not as a
376 replacement.
377 .SH "ENVIRONMENT"
378 The environment variable
379 .B GZIP
380 can hold a set of default options for
381 .IR gzip .
382 These options are interpreted first and can be overwritten by
383 explicit command line parameters. For example:
384       for sh:    GZIP="-8v --name"; export GZIP
385       for csh:   setenv GZIP "-8v --name"
386       for MSDOS: set GZIP=-8v --name
387
388 On Vax/VMS, the name of the environment variable is GZIP_OPT, to
389 avoid a conflict with the symbol set for invocation of the program.
390 .SH "SEE ALSO"
391 znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), zip(1), unzip(1), compress(1)
392 .PP
393 The
394 .I gzip
395 file format is specified in P. Deutsch, \s-1GZIP\s0 file format
396 specification version 4.3,
397 .BR <http://www.ietf.org/rfc/rfc1952.txt> ,
398 Internet RFC 1952 (May 1996).
399 The
400 .I zip
401 deflation format is specified in P. Deutsch, \s-1DEFLATE\s0 Compressed
402 Data Format Specification version 1.3,
403 .BR <http://www.ietf.org/rfc/rfc1951.txt> ,
404 Internet RFC 1951 (May 1996).
405 .SH "DIAGNOSTICS"
406 Exit status is normally 0;
407 if an error occurs, exit status is 1. If a warning occurs, exit status is 2.
408 .TP
409 Usage: gzip [-cdfhklLnNrtvV19] [-S suffix] [file ...]
410 Invalid options were specified on the command line.
411 .TP
412 \fIfile\fP\^: not in gzip format
413 The file specified to
414 .I gunzip
415 has not been compressed.
416 .TP
417 \fIfile\fP\^: Corrupt input. Use zcat to recover some data.
418 The compressed file has been damaged. The data up to the point of failure
419 can be recovered using
420
421       zcat \fIfile\fP > recover
422 .TP
423 \fIfile\fP\^: compressed with \fIxx\fP bits, can only handle \fIyy\fP bits
424 .I File
425 was compressed (using LZW) by a program that could deal with
426 more
427 .I bits
428 than the decompress code on this machine.
429 Recompress the file with gzip, which compresses better and uses
430 less memory.
431 .TP
432 \fIfile\fP\^: already has .gz suffix -- no change
433 The file is assumed to be already compressed.
434 Rename the file and try again.
435 .TP
436 \fIfile\fP already exists; do you wish to overwrite (y or n)?
437 Respond "y" if you want the output file to be replaced; "n" if not.
438 .TP
439 gunzip: corrupt input
440 A SIGSEGV violation was detected which usually means that the input file has
441 been corrupted.
442 .TP
443 \fIxx.x%\fP Percentage of the input saved by compression.
444 (Relevant only for
445 .BR \-v
446 and
447 .BR \-l \.)
448 .TP
449 -- not a regular file or directory: ignored
450 When the input file is not a regular file or directory,
451 (e.g. a symbolic link, socket, FIFO, device file), it is
452 left unaltered.
453 .TP
454 -- has \fIxx\fP other links: unchanged
455 The input file has links; it is left unchanged.  See
456 .IR ln "(1)"
457 for more information. Use the
458 .B \-f
459 flag to force compression of multiply-linked files.
460 .SH CAVEATS
461 When writing compressed data to a tape, it is generally necessary to
462 pad the output with zeroes up to a block boundary. When the data is
463 read and the whole block is passed to
464 .I gunzip
465 for decompression,
466 .I gunzip
467 detects that there is extra trailing garbage after the compressed data
468 and emits a warning by default. You have to use the --quiet option to
469 suppress the warning. This option can be set in the
470 .B GZIP
471 environment variable as in:
472   for sh:  GZIP="-q"  tar -xfz --block-compress /dev/rst0
473   for csh: (setenv GZIP -q; tar -xfz --block-compr /dev/rst0
474
475 In the above example, gzip is invoked implicitly by the -z option of
476 GNU tar. Make sure that the same block size (-b option of tar) is used
477 for reading and writing compressed data on tapes.  (This example
478 assumes you are using the GNU version of tar.)
479 .SH BUGS
480 The gzip format represents the input size modulo 2^32, so the
481 --list option reports incorrect uncompressed sizes and compression
482 ratios for uncompressed files 4 GB and larger.  To work around this
483 problem, you can use the following command to discover a large
484 uncompressed file's true size:
485
486       zcat file.gz | wc -c
487
488 The --list option reports sizes as -1 and crc as ffffffff if the
489 compressed file is on a non seekable media.
490
491 In some rare cases, the --best option gives worse compression than
492 the default compression level (-6). On some highly redundant files,
493 .I compress
494 compresses better than
495 .IR gzip .
496 .SH "COPYRIGHT NOTICE"
497 Copyright \(co 1998, 1999, 2001, 2002, 2012 Free Software Foundation, Inc.
498 .br
499 Copyright \(co 1992, 1993 Jean-loup Gailly
500 .PP
501 Permission is granted to make and distribute verbatim copies of
502 this manual provided the copyright notice and this permission notice
503 are preserved on all copies.
504 .ig
505 Permission is granted to process this file through troff and print the
506 results, provided the printed document carries copying permission
507 notice identical to this one except for the removal of this paragraph
508 (this paragraph not being relevant to the printed manual).
509 ..
510 .PP
511 Permission is granted to copy and distribute modified versions of this
512 manual under the conditions for verbatim copying, provided that the entire
513 resulting derived work is distributed under the terms of a permission
514 notice identical to this one.
515 .PP
516 Permission is granted to copy and distribute translations of this manual
517 into another language, under the above conditions for modified versions,
518 except that this permission notice may be stated in a translation approved
519 by the Foundation.