xref: /freebsd/usr.bin/gzip/gzip.1 (revision 49b49cda41feabe3439f7318e8bf40e3896c7bf4)
1.\"	$NetBSD: gzip.1,v 1.26 2015/10/27 07:36:18 mrg 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$
28.Dd October 26, 2015
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
59The
60.Nm
61program compresses and decompresses files using Lempel-Ziv coding
62(LZ77).
63If no
64.Ar files
65are specified,
66.Nm
67will compress from standard input, or decompress to standard output.
68When in compression mode, each
69.Ar file
70will be replaced with another file with the suffix, set by the
71.Fl S Ar suffix
72option, added, if possible.
73.Pp
74In decompression mode, each
75.Ar file
76will be checked for existence, as will the file with the suffix
77added.
78Each
79.Ar file
80argument must contain a separate complete archive;
81when multiple
82.Ar files
83are indicated, each is decompressed in turn.
84.Pp
85In the case of
86.Nm gzcat
87the resulting data is then concatenated in the manner of
88.Xr cat 1 .
89.Pp
90If invoked as
91.Nm gunzip
92then the
93.Fl d
94option is enabled.
95If invoked as
96.Nm zcat
97or
98.Nm gzcat
99then both the
100.Fl c
101and
102.Fl d
103options are enabled.
104.Pp
105This version of
106.Nm
107is also capable of decompressing files compressed using
108.Xr compress 1 ,
109.Xr bzip2 1 ,
110or
111.Xr xz 1 .
112.Sh OPTIONS
113The following options are available:
114.Bl -tag -width XXrXXXrecursiveX
115.It Fl 1 , -fast
116.It Fl 2 , 3 , 4 , 5 , 6 , 7 , 8
117.It Fl 9 , -best
118These options change the compression level used, with the
119.Fl 1
120option being the fastest, with less compression, and the
121.Fl 9
122option being the slowest, with optimal compression.
123The default compression level is 6.
124.It Fl c , -stdout , -to-stdout
125This option specifies that output will go to the standard output
126stream, leaving files intact.
127.It Fl d , -decompress , -uncompress
128This option selects decompression rather than compression.
129.It Fl f , -force
130This option turns on force mode.
131This allows files with multiple links, symbolic links to regular files,
132overwriting of pre-existing files, reading from or writing to a terminal,
133and when combined with the
134.Fl c
135option, allowing non-compressed data to pass through unchanged.
136.It Fl h , -help
137This option prints a usage summary and exits.
138.It Fl k , -keep
139Keep (do not delete) input files during compression
140or decompression.
141.It Fl L , -license
142This option prints
143.Nm
144license.
145.It Fl l , -list
146This option displays information about the file's compressed and
147uncompressed size, ratio, uncompressed name.
148With the
149.Fl v
150option, it also displays the compression method, CRC, date and time
151embedded in the file.
152.It Fl N , -name
153This option causes the stored filename in the input file to be used
154as the output file.
155.It Fl n , -no-name
156This option stops the filename and timestamp from being stored in
157the output file.
158.It Fl q , -quiet
159With this option, no warnings or errors are printed.
160.It Fl r , -recursive
161This option is used to
162.Nm
163the files in a directory tree individually, using the
164.Xr fts 3
165library.
166.It Fl S Ar suffix , Fl -suffix Ar suffix
167This option changes the default suffix from .gz to
168.Ar suffix .
169.It Fl t , -test
170This option will test compressed files for integrity.
171.It Fl V , -version
172This option prints the version of the
173.Nm
174program.
175.It Fl v , -verbose
176This option turns on verbose mode, which prints the compression
177ratio for each file compressed.
178.El
179.Sh ENVIRONMENT
180If the environment variable
181.Ev GZIP
182is set, it is parsed as a white-space separated list of options
183handled before any options on the command line.
184Options on the command line will override anything in
185.Ev GZIP .
186.Sh EXIT STATUS
187The
188.Nm
189utility exits 0 on success,
1901 on errors,
191and 2 if a warning occurs.
192.Sh SEE ALSO
193.Xr bzip2 1 ,
194.Xr compress 1 ,
195.Xr xz 1 ,
196.Xr fts 3 ,
197.Xr zlib 3
198.Sh HISTORY
199The
200.Nm
201program was originally written by Jean-loup Gailly, licensed under
202the GNU Public Licence.
203Matthew R. Green wrote a simple front end for
204.Nx 1.3
205distribution media, based on the freely re-distributable zlib library.
206It was enhanced to be mostly feature-compatible with the original
207GNU
208.Nm
209program for
210.Nx 2.0 .
211.Pp
212This implementation of
213.Nm
214was ported based on the
215.Nx
216.Nm ,
217and first appeared in
218.Fx 7.0 .
219.Sh AUTHORS
220.An -nosplit
221This implementation of
222.Nm
223was written by
224.An Matthew R. Green Aq Mt mrg@eterna.com.au
225with unpack support written by
226.An Xin LI Aq Mt delphij@FreeBSD.org .
227.Sh BUGS
228According to RFC 1952, the recorded file size is stored in a 32-bit
229integer, therefore, it cannot represent files larger than 4GB.
230This limitation also applies to
231.Fl l
232option of
233.Nm
234utility.
235