xref: /netbsd-src/usr.bin/gzip/gzip.1 (revision 2026b7285b519b6985686c4f29b6309b5e58de6d)
1.\"	$NetBSD: gzip.1,v 1.32 2024/02/04 05:43:07 mrg 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 ,
99.Ar lzip ,
100or
101.Xr xz 1 .
102.Sh OPTIONS
103The following options are available:
104.Bl -tag -width XXrXXXrecursiveX
105.It Fl 1 , Fl Fl fast
106.It Fl 2
107.It Fl 3
108.It Fl 4
109.It Fl 5
110.It Fl 6
111.It Fl 7
112.It Fl 8
113.It Fl 9 , Fl Fl best
114These options change the compression level used, with the
115.Fl 1
116option being the fastest, with less compression, and the
117.Fl 9
118option being the slowest, with optimal compression.
119The default compression level is 6.
120.It Fl c , Fl Fl stdout , Fl Fl to-stdout
121This option specifies that output will go to the standard output
122stream, leaving files intact.
123.It Fl d , Fl Fl decompress , Fl Fl uncompress
124This option selects decompression rather than compression.
125.It Fl f , Fl Fl force
126This option turns on force mode.
127This allows files with multiple links, overwriting of pre-existing
128files, reading from or writing to a terminal, and when combined
129with the
130.Fl c
131option, allowing non-compressed data to pass through unchanged.
132.It Fl h , Fl Fl help
133This option prints a usage summary and exits.
134.It Fl k , Fl Fl keep
135This option prevents
136.Nm
137from deleting input files after (de)compression.
138.It Fl l , Fl Fl list
139This option displays information about the file's compressed and
140uncompressed size, ratio, uncompressed name.
141With the
142.Fl v
143option, it also displays the compression method, CRC, date and time
144embedded in the file.
145.It Fl N , Fl Fl name
146This option causes the stored filename in the input file to be used
147as the output file.
148.It Fl n , Fl Fl no-name
149This option stops the filename and timestamp from being stored in
150the output file.
151.It Fl q , Fl Fl quiet
152With this option, no warnings or errors are printed.
153.It Fl r , Fl Fl recursive
154This option is used to
155.Nm
156the files in a directory tree individually, using the
157.Xr fts 3
158library.
159.It Fl S Ar suffix , Fl Fl suffix Ar suffix
160This option changes the default suffix from .gz to
161.Ar suffix .
162.It Fl t , Fl Fl test
163This option will test compressed files for integrity.
164.It Fl V , Fl Fl version
165This option prints the version of the
166.Nm
167program.
168.It Fl v , Fl Fl verbose
169This option turns on verbose mode, which prints the compression
170ratio for each file compressed.
171.El
172.Sh ENVIRONMENT
173If the environment variable
174.Ev GZIP
175is set, it is parsed as a white-space separated list of options
176handled before any options on the command line.
177Options on the command line will override anything in
178.Ev GZIP .
179.Sh EXIT STATUS
180The
181.Nm
182utility exits 0 on success,
1831 on errors,
184and 2 if a warning occurs.
185.Sh SIGNALS
186.Nm
187responds to the following signals:
188.Bl -tag -width indent
189.It Dv SIGINFO
190Report progress to standard error.
191.El
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 manual documents
213.Nx
214.Nm
215version 20170803.
216.Sh AUTHORS
217This implementation of
218.Nm
219was written by
220.An Matthew R. Green Aq Mt mrg@eterna23.net .
221