1 | 1 GZIP
|
---|
2 | NAME
|
---|
3 | gzip, gunzip, zcat - compress or expand files
|
---|
4 |
|
---|
5 | SYNOPSIS
|
---|
6 | gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]
|
---|
7 | gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
|
---|
8 | zcat [ -fhLV ] [ name ... ]
|
---|
9 |
|
---|
10 | 2 DESCRIPTION
|
---|
11 | Gzip reduces the size of the named files using Lempel-Ziv
|
---|
12 | coding (LZ77). Whenever possible, each file is replaced by
|
---|
13 | one with the extension .gz, while keeping the same ownership
|
---|
14 | modes, access and modification times. (The default exten-
|
---|
15 | sion is -gz for VMS, z for MSDOS, OS/2 FAT, Windows NT FAT
|
---|
16 | and Atari.) If no files are specified, or if a file name is
|
---|
17 | "-", the standard input is compressed to the standard out-
|
---|
18 | put. Gzip will only attempt to compress regular files.
|
---|
19 |
|
---|
20 | If the compressed file name is too long for its file system,
|
---|
21 | gzip truncates it. Gzip attempts to truncate only the parts
|
---|
22 | of the file name longer than 3 characters. (A part is del-
|
---|
23 | imited by dots.) If the name consists of small parts only,
|
---|
24 | the longest parts are truncated. For example, if file names
|
---|
25 | are limited to 14 characters, gzip.msdos.exe is compressed
|
---|
26 | to gzi.msd.exe.gz. Names are not truncated on systems which
|
---|
27 | do not have a limit on file name length.
|
---|
28 |
|
---|
29 | By default, gzip keeps the original file name and timestamp
|
---|
30 | in the compressed file. These are used when decompressing
|
---|
31 | the file with the -N option. This is useful when the
|
---|
32 | compressed file name was truncated or when the time stamp
|
---|
33 | was not preserved after a file transfer.
|
---|
34 |
|
---|
35 | Compressed files can be restored to their original form
|
---|
36 | using gzip -d or gunzip or zcat. If the original name saved
|
---|
37 | in the compressed file is not suitable for its file system,
|
---|
38 | a new name is constructed from the original one to make it
|
---|
39 | legal.
|
---|
40 |
|
---|
41 | gunzip takes a list of files on its command line and
|
---|
42 | replaces each file whose name ends with .gz, -gz, .z, -z, _z
|
---|
43 | or .Z and which begins with the correct magic number with an
|
---|
44 | uncompressed file without the original extension. gunzip
|
---|
45 | also recognizes the special extensions .tgz and .taz as
|
---|
46 | shorthands for .tar.gz and .tar.Z respectively. When
|
---|
47 | compressing, gzip uses the .tgz extension if necessary
|
---|
48 | instead of truncating a file with a .tar extension.
|
---|
49 |
|
---|
50 | gunzip can currently decompress files created by gzip, zip,
|
---|
51 | compress, compress -H or pack. The detection of the input
|
---|
52 | format is automatic. When using the first two formats,
|
---|
53 | gunzip checks a 32 bit CRC. For pack, gunzip checks the
|
---|
54 | uncompressed length. The standard compress format was not
|
---|
55 | designed to allow consistency checks. However gunzip is
|
---|
56 | sometimes able to detect a bad .Z file. If you get an error
|
---|
57 | when uncompressing a .Z file, do not assume that the .Z file
|
---|
58 | is correct simply because the standard uncompress does not
|
---|
59 | complain. This generally means that the standard uncompress
|
---|
60 | does not check its input, and happily generates garbage out-
|
---|
61 | put. The SCO compress -H format (lzh compression method)
|
---|
62 | does not include a CRC but also allows some consistency
|
---|
63 | checks.
|
---|
64 |
|
---|
65 | Files created by zip can be uncompressed by gzip only if
|
---|
66 | they have a single member compressed with the 'deflation'
|
---|
67 | method. This feature is only intended to help conversion of
|
---|
68 | tar.zip files to the tar.gz format. To extract zip files
|
---|
69 | with several members, use unzip instead of gunzip.
|
---|
70 |
|
---|
71 | zcat is identical to gunzip -c. (On some systems, zcat may
|
---|
72 | be installed as gzcat to preserve the original link to
|
---|
73 | compress.) zcat uncompresses either a list of files on the
|
---|
74 | command line or its standard input and writes the
|
---|
75 | uncompressed data on standard output. zcat will uncompress
|
---|
76 | files that have the correct magic number whether they have a
|
---|
77 | .gz suffix or not.
|
---|
78 |
|
---|
79 | Gzip uses the Lempel-Ziv algorithm used in zip and PKZIP.
|
---|
80 | The amount of compression obtained depends on the size of
|
---|
81 | the input and the distribution of common substrings. Typi-
|
---|
82 | cally, text such as source code or English is reduced by
|
---|
83 | 60-70%. Compression is generally much better than that
|
---|
84 | achieved by LZW (as used in compress), Huffman coding (as
|
---|
85 | used in pack), or adaptive Huffman coding (compact).
|
---|
86 |
|
---|
87 | Compression is always performed, even if the compressed file
|
---|
88 | is slightly larger than the original. The worst case expan-
|
---|
89 | sion is a few bytes for the gzip file header, plus 5 bytes
|
---|
90 | every 32K block, or an expansion ratio of 0.015% for large
|
---|
91 | files. Note that the actual number of used disk blocks
|
---|
92 | almost never increases. gzip preserves the mode, ownership
|
---|
93 | and timestamps of files when compressing or decompressing.
|
---|
94 |
|
---|
95 | 2 OPTIONS
|
---|
96 | -a --ascii
|
---|
97 | Ascii text mode: convert end-of-lines using local con-
|
---|
98 | ventions. This option is supported only on some non-
|
---|
99 | Unix systems. For MSDOS, CR LF is converted to LF when
|
---|
100 | compressing, and LF is converted to CR LF when
|
---|
101 | decompressing.
|
---|
102 |
|
---|
103 | -c --stdout --to-stdout
|
---|
104 | Write output on standard output; keep original files
|
---|
105 | unchanged. If there are several input files, the out-
|
---|
106 | put consists of a sequence of independently compressed
|
---|
107 | members. To obtain better compression, concatenate all
|
---|
108 | input files before compressing them.
|
---|
109 |
|
---|
110 | -d --decompress --uncompress
|
---|
111 | Decompress.
|
---|
112 |
|
---|
113 | -f --force
|
---|
114 | Force compression or decompression even if the file has
|
---|
115 | multiple links or the corresponding file already
|
---|
116 | exists, or if the compressed data is read from or writ-
|
---|
117 | ten to a terminal. If the input data is not in a format
|
---|
118 | recognized by gzip, and if the option --stdout is also
|
---|
119 | given, copy the input data without change to the stan-
|
---|
120 | dard output: let zcat behave as cat. If -f is not given,
|
---|
121 | and when not running in the background, gzip prompts to
|
---|
122 | verify whether an existing file should be overwritten.
|
---|
123 |
|
---|
124 | -h --help
|
---|
125 | Display a help screen and quit.
|
---|
126 |
|
---|
127 | -l --list
|
---|
128 | For each compressed file, list the following fields:
|
---|
129 |
|
---|
130 | compressed size: size of the compressed file
|
---|
131 | uncompressed size: size of the uncompressed file
|
---|
132 | ratio: compression ratio (0.0% if unknown)
|
---|
133 | uncompressed_name: name of the uncompressed file
|
---|
134 |
|
---|
135 | The uncompressed size is given as -1 on VMS because it
|
---|
136 | it is not possible to seek reliably to the end of the
|
---|
137 | compressed file, where this size is stored.
|
---|
138 |
|
---|
139 | In combination with the --verbose option, the following
|
---|
140 | fields are also displayed:
|
---|
141 |
|
---|
142 | method: compression method
|
---|
143 | crc: the 32-bit CRC of the uncompressed data
|
---|
144 | date & time: time stamp for the uncompressed file
|
---|
145 |
|
---|
146 | The compression methods currently supported are
|
---|
147 | deflate, compress, lzh (SCO compress -H) and pack. The
|
---|
148 | crc is given as ffffffff on VMS for the reason given
|
---|
149 | above about the uncompressed size.
|
---|
150 |
|
---|
151 | With --name, the uncompressed name, date and time are
|
---|
152 | those stored within the compress file if present.
|
---|
153 |
|
---|
154 | With --verbose, the size totals and compression ratio
|
---|
155 | for all files is also displayed, unless some sizes are
|
---|
156 | unknown. With --quiet, the title and totals lines are
|
---|
157 | not displayed.
|
---|
158 |
|
---|
159 | -L --license
|
---|
160 | Display the gzip license and quit.
|
---|
161 |
|
---|
162 | -n --no-name
|
---|
163 | When compressing, do not save the original file name
|
---|
164 | and time stamp by default. (The original name is always
|
---|
165 | saved if the name had to be truncated.) When
|
---|
166 | decompressing, do not restore the original file name if
|
---|
167 | present (remove only the gzip suffix from the
|
---|
168 | compressed file name) and do not restore the original
|
---|
169 | time stamp if present (copy it from the compressed
|
---|
170 | file). This option is the default when decompressing.
|
---|
171 |
|
---|
172 | -N --name
|
---|
173 | When compressing, always save the original file name
|
---|
174 | and time stamp; this is the default. When decompress-
|
---|
175 | ing, restore the original file name and time stamp if
|
---|
176 | present. This option is useful on systems which have a
|
---|
177 | limit on file name length or when the time stamp has
|
---|
178 | been lost after a file transfer.
|
---|
179 |
|
---|
180 | -q --quiet
|
---|
181 | Suppress all warnings.
|
---|
182 |
|
---|
183 | -r --recursive
|
---|
184 | Travel the directory structure recursively. If any of
|
---|
185 | the file names specified on the command line are direc-
|
---|
186 | tories, gzip will descend into the directory and
|
---|
187 | compress all the files it finds there (or decompress
|
---|
188 | them in the case of gunzip ).
|
---|
189 |
|
---|
190 | -S suf --suffix suf
|
---|
191 | Use suffix suf instead of -gz. Any suffix can be
|
---|
192 | given, but suffixes other than -z and -gz should be
|
---|
193 | avoided to avoid confusion when files are transferred
|
---|
194 | to other. A null suffix forces gunzip to try
|
---|
195 | decompression on all given files regardless of suffix,
|
---|
196 | as in:
|
---|
197 |
|
---|
198 | gunzip --suffix "" *.*
|
---|
199 |
|
---|
200 | Previous versions of gzip used the -z suffix. This was
|
---|
201 | changed to avoid a conflict with pack on Unix.
|
---|
202 |
|
---|
203 | -t --test
|
---|
204 | Test. Check the compressed file integrity.
|
---|
205 |
|
---|
206 | -v --verbose
|
---|
207 | Verbose. Display the name and percentage reduction for
|
---|
208 | each file compressed or decompressed.
|
---|
209 |
|
---|
210 | -V --version
|
---|
211 | Version. Display the version number and compilation
|
---|
212 | options then quit.
|
---|
213 |
|
---|
214 | -# --fast --best
|
---|
215 | Regulate the speed of compression using the specified
|
---|
216 | digit #, where -1 or --fast indicates the fastest
|
---|
217 | compression method (less compression) and -9 or --best
|
---|
218 | indicates the slowest compression method (best compres-
|
---|
219 | sion). The default compression level is -6 (that is,
|
---|
220 | biased towards high compression at expense of speed).
|
---|
221 |
|
---|
222 | 2 ENVIRONMENT
|
---|
223 | The environment variable GZIP_OPT can hold a set of default
|
---|
224 | options for gzip. These options are interpreted first and
|
---|
225 | can be overwritten by explicit command line parameters. For
|
---|
226 | example:
|
---|
227 | define GZIP_OPT "-8 -v"
|
---|
228 |
|
---|
229 | 2 SEE ALSO
|
---|
230 | compress, zip, unzip
|
---|
231 |
|
---|
232 | 2 DIAGNOSTICS
|
---|
233 | Exit status is normally 0; if an error occurs, exit status
|
---|
234 | is 1. If a warning occurs, exit status is 2.
|
---|
235 |
|
---|
236 | Usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
|
---|
237 | Invalid options were specified on the command line.
|
---|
238 | file: not in gzip format
|
---|
239 | The file specified to gunzip has not been
|
---|
240 | compressed.
|
---|
241 | file: Corrupt input. Use zcat to recover some data.
|
---|
242 | The compressed file has been damaged. The data up to
|
---|
243 | the point of failure can be recovered using
|
---|
244 | define /user sys$output file.recover
|
---|
245 | zcat file
|
---|
246 | file: compressed with xx bits, can only handle yy bits
|
---|
247 | File was compressed (using LZW) by a program that
|
---|
248 | could deal with more bits than the decompress code
|
---|
249 | on this machine. Recompress the file with gzip,
|
---|
250 | which compresses better and uses less memory.
|
---|
251 | file: already has -gz suffix -- no change
|
---|
252 | The file is assumed to be already compressed.
|
---|
253 | Rename the file and try again.
|
---|
254 | file already exists; do you wish to overwrite (y or n)?
|
---|
255 | Respond "y" if you want the output file to be
|
---|
256 | replaced; "n" if not.
|
---|
257 | gunzip: corrupt input
|
---|
258 | A SIGSEGV violation was detected which usually means
|
---|
259 | that the input file has been corrupted.
|
---|
260 | xx.x%
|
---|
261 | Percentage of the input saved by compression.
|
---|
262 | (Relevant only for -v and -l.)
|
---|
263 | -- not a regular file or directory: ignored
|
---|
264 | When the input file is not a regular file or direc-
|
---|
265 | tory, it is left unaltered.
|
---|
266 |
|
---|
267 | 2 CAVEATS
|
---|
268 | On VMS:
|
---|
269 | - upper case options need quotes: gzip "-V".
|
---|
270 | - restoration of timestamps and version numbers is not supported
|
---|
271 | - If a compressed file already exists, gzip -f overwrites it, it
|
---|
272 | does not create a new version.
|
---|
273 | - multi-part gzip files are not supported.
|
---|
274 | - gunzip does not preserve the input file format. You can use a
|
---|
275 | separate utility to restore the original format.
|
---|
276 | - gunzip and zcat can be used only if you have created the
|
---|
277 | links to gzip as documented in makegzip.com. Otherwise
|
---|
278 | you must use explicit parameters ("gzip -c" or "gzip -dc").
|
---|
279 | - gzip --list cannot give the uncompressed size and crc.
|
---|
280 |
|
---|
281 | When writing compressed data to a tape, it is generally
|
---|
282 | necessary to pad the output with zeroes up to a block boun-
|
---|
283 | dary. When the data is read and the whole block is passed to
|
---|
284 | gunzip for decompression, gunzip detects that there is extra
|
---|
285 | trailing garbage after the compressed data and emits a warn-
|
---|
286 | ing by default. You have to use the --quiet option to
|
---|
287 | suppress the warning. This option can be set in the GZIP_OPT
|
---|
288 | environment variable as in:
|
---|
289 | define GZIP_OPT "-q"
|
---|
290 |
|
---|
291 | 2 BUGS
|
---|
292 | On VMS, files in VFC record format are not correctly handled by
|
---|
293 | the C runtime library (the linefeed character is suppressed).
|
---|
294 |
|
---|
295 | In some rare cases, the --best option gives worse compres-
|
---|
296 | sion than the default compression level (-6). On some highly
|
---|
297 | redundant files, compress compresses better than gzip.
|
---|