xref: /netbsd-src/usr.bin/gzip/gzip.1 (revision 2026b7285b519b6985686c4f29b6309b5e58de6d)
1*2026b728Smrg.\"	$NetBSD: gzip.1,v 1.32 2024/02/04 05:43:07 mrg Exp $
24084ec54Smrg.\"
35e22a92eSmrg.\" Copyright (c) 1997, 2003, 2004, 2008, 2009, 2015, 2017 Matthew R. Green
44084ec54Smrg.\" All rights reserved.
54084ec54Smrg.\"
64084ec54Smrg.\" Redistribution and use in source and binary forms, with or without
74084ec54Smrg.\" modification, are permitted provided that the following conditions
84084ec54Smrg.\" are met:
94084ec54Smrg.\" 1. Redistributions of source code must retain the above copyright
104084ec54Smrg.\"    notice, this list of conditions and the following disclaimer.
114084ec54Smrg.\" 2. Redistributions in binary form must reproduce the above copyright
124084ec54Smrg.\"    notice, this list of conditions and the following disclaimer in the
134084ec54Smrg.\"    documentation and/or other materials provided with the distribution.
144084ec54Smrg.\"
154084ec54Smrg.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
164084ec54Smrg.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
174084ec54Smrg.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
184084ec54Smrg.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
194084ec54Smrg.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
204084ec54Smrg.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
214084ec54Smrg.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
224084ec54Smrg.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
234084ec54Smrg.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
244084ec54Smrg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
254084ec54Smrg.\" SUCH DAMAGE.
264084ec54Smrg.\"
274e70675dSwiz.Dd January 8, 2017
284084ec54Smrg.Dt GZIP 1
294084ec54Smrg.Os
304084ec54Smrg.Sh NAME
31b3e27e93Sabhinav.Nm gzip ,
32b3e27e93Sabhinav.Nm gunzip ,
33b3e27e93Sabhinav.Nm zcat
344084ec54Smrg.Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
354084ec54Smrg.Sh SYNOPSIS
364084ec54Smrg.Nm
37a4624b06Smrg.Op Fl cdfhlNnqrtVv
384084ec54Smrg.Op Fl S Ar suffix
394084ec54Smrg.Ar file
404084ec54Smrg.Oo
414084ec54Smrg.Ar file Oo ...
424084ec54Smrg.Oc
434084ec54Smrg.Oc
444084ec54Smrg.Nm gunzip
45f2392113Swiz.Op Fl cfhNqrtVv
464084ec54Smrg.Op Fl S Ar suffix
474084ec54Smrg.Ar file
484084ec54Smrg.Oo
494084ec54Smrg.Ar file Oo ...
504084ec54Smrg.Oc
514084ec54Smrg.Oc
524084ec54Smrg.Nm zcat
534084ec54Smrg.Op Fl fhV
544084ec54Smrg.Ar file
554084ec54Smrg.Oo
564084ec54Smrg.Ar file Oo ...
574084ec54Smrg.Oc
584084ec54Smrg.Oc
594084ec54Smrg.Sh DESCRIPTION
604084ec54SmrgThe
614084ec54Smrg.Nm
62f2392113Swizprogram compresses and decompresses files using Lempel-Ziv coding
63f2392113Swiz(LZ77).
644084ec54SmrgIf no
654084ec54Smrg.Ar files
664084ec54Smrgare specified,
674084ec54Smrg.Nm
684084ec54Smrgwill compress from standard input, or decompress to standard output.
694084ec54SmrgWhen in compression mode, each
704084ec54Smrg.Ar file
714084ec54Smrgwill be replaced with another file with the suffix, set by the
724084ec54Smrg.Fl S Ar suffix
734084ec54Smrgoption, added, if possible.
744084ec54SmrgIn decompression mode, each
754084ec54Smrg.Ar file
76f2392113Swizwill be checked for existence, as will the file with the suffix
77f2392113Swizadded.
784084ec54Smrg.Pp
794084ec54SmrgIf invoked as
804084ec54Smrg.Nm gunzip
814084ec54Smrgthen the
824084ec54Smrg.Fl d
834084ec54Smrgoption is enabled.
844084ec54SmrgIf invoked as
854084ec54Smrg.Nm zcat
864084ec54Smrgor
874084ec54Smrg.Nm gzcat
884084ec54Smrgthen both the
894084ec54Smrg.Fl c
90f2392113Swizand
91f2392113Swiz.Fl d
924084ec54Smrgoptions are enabled.
93a8763d19Swiz.Pp
94ecadec7fSmrgThis version of
95ecadec7fSmrg.Nm
9615d66087Swizis also capable of decompressing files compressed using
9775bbcb9aSwiz.Xr compress 1 ,
9875bbcb9aSwiz.Xr bzip2 1 ,
9941c9b009Schristos.Ar lzip ,
10015d66087Swizor
10175bbcb9aSwiz.Xr xz 1 .
1024084ec54Smrg.Sh OPTIONS
1034084ec54SmrgThe following options are available:
104f2392113Swiz.Bl -tag -width XXrXXXrecursiveX
1054e70675dSwiz.It Fl 1 , Fl Fl fast
1064084ec54Smrg.It Fl 2
1074084ec54Smrg.It Fl 3
1084084ec54Smrg.It Fl 4
1094084ec54Smrg.It Fl 5
1104084ec54Smrg.It Fl 6
1114084ec54Smrg.It Fl 7
1124084ec54Smrg.It Fl 8
1134e70675dSwiz.It Fl 9 , Fl Fl best
1144084ec54SmrgThese options change the compression level used, with the
1154084ec54Smrg.Fl 1
1164084ec54Smrgoption being the fastest, with less compression, and the
1174084ec54Smrg.Fl 9
1184084ec54Smrgoption being the slowest, with optimal compression.
119a9c239e6SmrgThe default compression level is 6.
1204e70675dSwiz.It Fl c , Fl Fl stdout , Fl Fl to-stdout
121f2392113SwizThis option specifies that output will go to the standard output
122f2392113Swizstream, leaving files intact.
1234e70675dSwiz.It Fl d , Fl Fl decompress , Fl Fl uncompress
124f2392113SwizThis option selects decompression rather than compression.
1254e70675dSwiz.It Fl f , Fl Fl force
126f2392113SwizThis option turns on force mode.
127f2392113SwizThis allows files with multiple links, overwriting of pre-existing
128f2392113Swizfiles, reading from or writing to a terminal, and when combined
129f2392113Swizwith the
130f2392113Swiz.Fl c
131f2392113Swizoption, allowing non-compressed data to pass through unchanged.
1324e70675dSwiz.It Fl h , Fl Fl help
133f2392113SwizThis option prints a usage summary and exits.
1344e70675dSwiz.It Fl k , Fl Fl keep
1354e70675dSwizThis option prevents
1364e70675dSwiz.Nm
1374e70675dSwizfrom deleting input files after (de)compression.
1384e70675dSwiz.It Fl l , Fl Fl list
139a4624b06SmrgThis option displays information about the file's compressed and
140cf799075Swizuncompressed size, ratio, uncompressed name.
141cf799075SwizWith the
142a4624b06Smrg.Fl v
143179b01d9Swizoption, it also displays the compression method, CRC, date and time
144a4624b06Smrgembedded in the file.
1454e70675dSwiz.It Fl N , Fl Fl name
146f2392113SwizThis option causes the stored filename in the input file to be used
147f2392113Swizas the output file.
1484e70675dSwiz.It Fl n , Fl Fl no-name
149a4a48f53SmrgThis option stops the filename and timestamp from being stored in
150a4a48f53Smrgthe output file.
1514e70675dSwiz.It Fl q , Fl Fl quiet
152f2392113SwizWith this option, no warnings or errors are printed.
1534e70675dSwiz.It Fl r , Fl Fl recursive
154f2392113SwizThis option is used to
155f2392113Swiz.Nm
156f2392113Swizthe files in a directory tree individually, using the
157f2392113Swiz.Xr fts 3
158f2392113Swizlibrary.
1594e70675dSwiz.It Fl S Ar suffix , Fl Fl suffix Ar suffix
160f2392113SwizThis option changes the default suffix from .gz to
161f2392113Swiz.Ar suffix .
1624e70675dSwiz.It Fl t , Fl Fl test
163f2392113SwizThis option will test compressed files for integrity.
1644e70675dSwiz.It Fl V , Fl Fl version
165f2392113SwizThis option prints the version of the
166f2392113Swiz.Nm
167f2392113Swizprogram.
1684e70675dSwiz.It Fl v , Fl Fl verbose
169f2392113SwizThis option turns on verbose mode, which prints the compression
170f2392113Swizratio for each file compressed.
1714084ec54Smrg.El
1720b76a77cSmrg.Sh ENVIRONMENT
1730b76a77cSmrgIf the environment variable
1740b76a77cSmrg.Ev GZIP
1750b76a77cSmrgis set, it is parsed as a white-space separated list of options
17675806e5aSwizhandled before any options on the command line.
17775806e5aSwizOptions on the command line will override anything in
1780b76a77cSmrg.Ev GZIP .
17960c6cf91Smrg.Sh EXIT STATUS
18060c6cf91SmrgThe
18160c6cf91Smrg.Nm
18260c6cf91Smrgutility exits 0 on success,
18360c6cf91Smrg1 on errors,
18460c6cf91Smrgand 2 if a warning occurs.
1855e22a92eSmrg.Sh SIGNALS
1865e22a92eSmrg.Nm
1875e22a92eSmrgresponds to the following signals:
1885e22a92eSmrg.Bl -tag -width indent
1895e22a92eSmrg.It Dv SIGINFO
1905e22a92eSmrgReport progress to standard error.
1915e22a92eSmrg.El
19275806e5aSwiz.Sh SEE ALSO
19315d66087Swiz.Xr bzip2 1 ,
19415d66087Swiz.Xr compress 1 ,
195b3e90801Schristos.Xr xz 1 ,
19675806e5aSwiz.Xr fts 3 ,
19775806e5aSwiz.Xr zlib 3
1984084ec54Smrg.Sh HISTORY
1994084ec54SmrgThe
2004084ec54Smrg.Nm
201f2392113Swizprogram was originally written by Jean-loup Gailly, licensed under
202f2392113Swizthe GNU Public Licence.
2034084ec54SmrgMatthew R. Green wrote a simple front end for
2044084ec54Smrg.Nx 1.3
205f2392113Swizdistribution media, based on the freely re-distributable zlib library.
206f2392113SwizIt was enhanced to be mostly feature-compatible with the original
207f2392113SwizGNU
2084084ec54Smrg.Nm
2094084ec54Smrgprogram for
2104084ec54Smrg.Nx 2.0 .
21175fa5559Smrg.Pp
21275fa5559SmrgThis manual documents
21375fa5559Smrg.Nx
21475fa5559Smrg.Nm
2155e22a92eSmrgversion 20170803.
2164084ec54Smrg.Sh AUTHORS
2171d0e9794SmrgThis implementation of
2184084ec54Smrg.Nm
2191d0e9794Smrgwas written by
220*2026b728Smrg.An Matthew R. Green Aq Mt mrg@eterna23.net .
221