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