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