source: vendor/gzip/1.3.11/gzip.1@ 3398

Last change on this file since 3398 was 3325, checked in by bird, 18 years ago

gzip 1.3.11

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