file_cmds-264.1.1.tar.gz
[apple/file_cmds.git] / gzip / gzip.1
1 .\"     $NetBSD: gzip.1,v 1.21 2011/06/19 02:22:36 christos Exp $
2 .\"
3 .\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD: src/usr.bin/gzip/gzip.1,v 1.11 2011/10/10 06:37:32 delphij Exp $
28 .Dd October 9, 2011
29 .Dt GZIP 1
30 .Os
31 .Sh NAME
32 .Nm gzip
33 .Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
34 .Sh SYNOPSIS
35 .Nm
36 .Op Fl cdfhkLlNnqrtVv
37 .Op Fl S Ar suffix
38 .Ar file
39 .Oo
40 .Ar file Oo ...
41 .Oc
42 .Oc
43 .Nm gunzip
44 .Op Fl cfhkLNqrtVv
45 .Op Fl S Ar suffix
46 .Ar file
47 .Oo
48 .Ar file Oo ...
49 .Oc
50 .Oc
51 .Nm zcat
52 .Op Fl fhV
53 .Ar file
54 .Oo
55 .Ar file Oo ...
56 .Oc
57 .Oc
58 .Sh DESCRIPTION
59 The
60 .Nm
61 program compresses and decompresses files using Lempel-Ziv coding
62 (LZ77).
63 If no
64 .Ar files
65 are specified,
66 .Nm
67 will compress from standard input, or decompress to standard output.
68 When in compression mode, each
69 .Ar file
70 will be replaced with another file with the suffix, set by the
71 .Fl S Ar suffix
72 option, added, if possible.
73 .Pp
74 In decompression mode, each
75 .Ar file
76 will be checked for existence, as will the file with the suffix
77 added.
78 Each
79 .Ar file
80 argument must contain a separate complete archive;
81 when multiple
82 .Ar files
83 are indicated, each is decompressed in turn.
84 .Pp
85 In the case of
86 .Nm gzcat
87 the resulting data is then concatenated in the manner of
88 .Xr cat 1 .
89 .Pp
90 If invoked as
91 .Nm gunzip
92 then the
93 .Fl d
94 option is enabled.
95 If invoked as
96 .Nm zcat
97 or
98 .Nm gzcat
99 then both the
100 .Fl c
101 and
102 .Fl d
103 options are enabled.
104 When invoked as
105 .Nm zcat ,
106 .Dq .Z
107 will be appended to all filenames that do not have that suffix.
108 .Pp
109 This version of
110 .Nm
111 is also capable of decompressing files compressed using
112 .Xr compress 1
113 or
114 .Xr bzip2 1 .
115 .Sh OPTIONS
116 The following options are available:
117 .Bl -tag -width XXrXXXrecursiveX
118 .It Fl 1 , -fast
119 .It Fl 2 , 3 , 4 , 5 , 6 , 7 , 8
120 .It Fl 9 , -best
121 These options change the compression level used, with the
122 .Fl 1
123 option being the fastest, with less compression, and the
124 .Fl 9
125 option being the slowest, with optimal compression.
126 The default compression level is 6.
127 .It Fl c , -stdout , -to-stdout
128 This option specifies that output will go to the standard output
129 stream, leaving files intact.
130 .It Fl d , -decompress , -uncompress
131 This option selects decompression rather than compression.
132 .It Fl f , -force
133 This option turns on force mode.
134 This allows files with multiple links, symbolic links to regular files,
135 overwriting of pre-existing files, reading from or writing to a terminal,
136 and when combined with the
137 .Fl c
138 option, allowing non-compressed data to pass through unchanged.
139 .It Fl h , -help
140 This option prints a usage summary and exits.
141 .It Fl k , -keep
142 Keep (don't delete) input files during compression
143 or decompression.
144 .It Fl L , -license
145 This option prints
146 .Nm
147 license.
148 .It Fl l , -list
149 This option displays information about the file's compressed and
150 uncompressed size, ratio, uncompressed name.
151 With the
152 .Fl v
153 option, it also displays the compression method, CRC, date and time
154 embedded in the file.
155 .It Fl N , -name
156 This option causes the stored filename in the input file to be used
157 as the output file.
158 .It Fl n , -no-name
159 This option stops the filename and timestamp from being stored in
160 the output file.
161 .It Fl q , -quiet
162 With this option, no warnings or errors are printed.
163 .It Fl r , -recursive
164 This option is used to
165 .Nm
166 the files in a directory tree individually, using the
167 .Xr fts 3
168 library.
169 .It Fl S Ar suffix , Fl -suffix Ar suffix
170 This option changes the default suffix from .gz to
171 .Ar suffix .
172 .It Fl t , -test
173 This option will test compressed files for integrity.
174 .It Fl V , -version
175 This option prints the version of the
176 .Nm
177 program.
178 .It Fl v , -verbose
179 This option turns on verbose mode, which prints the compression
180 ratio for each file compressed.
181 .El
182 .Sh ENVIRONMENT
183 If the environment variable
184 .Ev GZIP
185 is set, it is parsed as a white-space separated list of options
186 handled before any options on the command line.
187 Options on the command line will override anything in
188 .Ev GZIP .
189 .Sh SEE ALSO
190 .Xr bzip2 1 ,
191 .Xr compress 1 ,
192 .Xr xz 1 ,
193 .Xr fts 3 ,
194 .Xr zlib 3 ,
195 .Xr compat 5
196 .Sh HISTORY
197 The
198 .Nm
199 program was originally written by Jean-loup Gailly, licensed under
200 the GNU Public Licence.
201 Matthew R. Green wrote a simple front end for
202 .Nx 1.3
203 distribution media, based on the freely re-distributable zlib library.
204 It was enhanced to be mostly feature-compatible with the original
205 GNU
206 .Nm
207 program for
208 .Nx 2.0 .
209 .Pp
210 This implementation of
211 .Nm
212 was ported based on the
213 .Nx
214 .Nm ,
215 and first appeared in
216 .Fx 7.0 .
217 .Sh AUTHORS
218 .An -nosplit
219 This implementation of
220 .Nm
221 was written by
222 .An Matthew R. Green Aq mrg@eterna.com.au
223 with unpack support written by
224 .An Xin LI Aq delphij@FreeBSD.org .
225 .Sh BUGS
226 According to RFC 1952, the recorded file size is stored in a 32-bit
227 integer, therefore, it can not represent files larger than 4GB.
228 This limitation also applies to
229 .Fl l
230 option of
231 .Nm
232 utility.