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