xref: /netbsd-src/usr.bin/gzip/gzip.1 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: gzip.1,v 1.30 2017/10/22 17:36:49 abhinav Exp $
2.\"
3.\" Copyright (c) 1997, 2003, 2004, 2008, 2009, 2015, 2017 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.Dd January 8, 2017
28.Dt GZIP 1
29.Os
30.Sh NAME
31.Nm gzip ,
32.Nm gunzip ,
33.Nm zcat
34.Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
35.Sh SYNOPSIS
36.Nm
37.Op Fl cdfhlNnqrtVv
38.Op Fl S Ar suffix
39.Ar file
40.Oo
41.Ar file Oo ...
42.Oc
43.Oc
44.Nm gunzip
45.Op Fl cfhNqrtVv
46.Op Fl S Ar suffix
47.Ar file
48.Oo
49.Ar file Oo ...
50.Oc
51.Oc
52.Nm zcat
53.Op Fl fhV
54.Ar file
55.Oo
56.Ar file Oo ...
57.Oc
58.Oc
59.Sh DESCRIPTION
60The
61.Nm
62program compresses and decompresses files using Lempel-Ziv coding
63(LZ77).
64If no
65.Ar files
66are specified,
67.Nm
68will compress from standard input, or decompress to standard output.
69When in compression mode, each
70.Ar file
71will be replaced with another file with the suffix, set by the
72.Fl S Ar suffix
73option, added, if possible.
74In decompression mode, each
75.Ar file
76will be checked for existence, as will the file with the suffix
77added.
78.Pp
79If invoked as
80.Nm gunzip
81then the
82.Fl d
83option is enabled.
84If invoked as
85.Nm zcat
86or
87.Nm gzcat
88then both the
89.Fl c
90and
91.Fl d
92options are enabled.
93.Pp
94This version of
95.Nm
96is also capable of decompressing files compressed using
97.Xr compress 1 ,
98.Xr bzip2 1 ,
99or
100.Xr xz 1 .
101.Sh OPTIONS
102The following options are available:
103.Bl -tag -width XXrXXXrecursiveX
104.It Fl 1 , Fl Fl fast
105.It Fl 2
106.It Fl 3
107.It Fl 4
108.It Fl 5
109.It Fl 6
110.It Fl 7
111.It Fl 8
112.It Fl 9 , Fl Fl best
113These options change the compression level used, with the
114.Fl 1
115option being the fastest, with less compression, and the
116.Fl 9
117option being the slowest, with optimal compression.
118The default compression level is 6.
119.It Fl c , Fl Fl stdout , Fl Fl to-stdout
120This option specifies that output will go to the standard output
121stream, leaving files intact.
122.It Fl d , Fl Fl decompress , Fl Fl uncompress
123This option selects decompression rather than compression.
124.It Fl f , Fl Fl force
125This option turns on force mode.
126This allows files with multiple links, overwriting of pre-existing
127files, reading from or writing to a terminal, and when combined
128with the
129.Fl c
130option, allowing non-compressed data to pass through unchanged.
131.It Fl h , Fl Fl help
132This option prints a usage summary and exits.
133.It Fl k , Fl Fl keep
134This option prevents
135.Nm
136from deleting input files after (de)compression.
137.It Fl l , Fl Fl list
138This option displays information about the file's compressed and
139uncompressed size, ratio, uncompressed name.
140With the
141.Fl v
142option, it also displays the compression method, CRC, date and time
143embedded in the file.
144.It Fl N , Fl Fl name
145This option causes the stored filename in the input file to be used
146as the output file.
147.It Fl n , Fl Fl no-name
148This option stops the filename and timestamp from being stored in
149the output file.
150.It Fl q , Fl Fl quiet
151With this option, no warnings or errors are printed.
152.It Fl r , Fl Fl recursive
153This option is used to
154.Nm
155the files in a directory tree individually, using the
156.Xr fts 3
157library.
158.It Fl S Ar suffix , Fl Fl suffix Ar suffix
159This option changes the default suffix from .gz to
160.Ar suffix .
161.It Fl t , Fl Fl test
162This option will test compressed files for integrity.
163.It Fl V , Fl Fl version
164This option prints the version of the
165.Nm
166program.
167.It Fl v , Fl Fl verbose
168This option turns on verbose mode, which prints the compression
169ratio for each file compressed.
170.El
171.Sh ENVIRONMENT
172If the environment variable
173.Ev GZIP
174is set, it is parsed as a white-space separated list of options
175handled before any options on the command line.
176Options on the command line will override anything in
177.Ev GZIP .
178.Sh EXIT STATUS
179The
180.Nm
181utility exits 0 on success,
1821 on errors,
183and 2 if a warning occurs.
184.Sh SIGNALS
185.Nm
186responds to the following signals:
187.Bl -tag -width indent
188.It Dv SIGINFO
189Report progress to standard error.
190.El
191.Sh SEE ALSO
192.Xr bzip2 1 ,
193.Xr compress 1 ,
194.Xr xz 1 ,
195.Xr fts 3 ,
196.Xr zlib 3
197.Sh HISTORY
198The
199.Nm
200program was originally written by Jean-loup Gailly, licensed under
201the GNU Public Licence.
202Matthew R. Green wrote a simple front end for
203.Nx 1.3
204distribution media, based on the freely re-distributable zlib library.
205It was enhanced to be mostly feature-compatible with the original
206GNU
207.Nm
208program for
209.Nx 2.0 .
210.Pp
211This manual documents
212.Nx
213.Nm
214version 20170803.
215.Sh AUTHORS
216This implementation of
217.Nm
218was written by
219.An Matthew R. Green Aq Mt mrg@eterna.com.au .
220