xref: /freebsd/usr.bin/gzip/gzip.1 (revision bca072af62b8b75f90e1626d9c785a57da6f6254)
19a9ea25fSXin LI.\"	$NetBSD: gzip.1,v 1.18 2005/09/30 13:46:56 wiz Exp $
29a9ea25fSXin LI.\"
39a9ea25fSXin LI.\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
49a9ea25fSXin LI.\" All rights reserved.
59a9ea25fSXin LI.\"
69a9ea25fSXin LI.\" Redistribution and use in source and binary forms, with or without
79a9ea25fSXin LI.\" modification, are permitted provided that the following conditions
89a9ea25fSXin LI.\" are met:
99a9ea25fSXin LI.\" 1. Redistributions of source code must retain the above copyright
109a9ea25fSXin LI.\"    notice, this list of conditions and the following disclaimer.
119a9ea25fSXin LI.\" 2. Redistributions in binary form must reproduce the above copyright
129a9ea25fSXin LI.\"    notice, this list of conditions and the following disclaimer in the
139a9ea25fSXin LI.\"    documentation and/or other materials provided with the distribution.
149a9ea25fSXin LI.\" 3. The name of the author may not be used to endorse or promote products
159a9ea25fSXin LI.\"    derived from this software without specific prior written permission.
169a9ea25fSXin LI.\"
179a9ea25fSXin LI.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
189a9ea25fSXin LI.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
199a9ea25fSXin LI.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
209a9ea25fSXin LI.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
219a9ea25fSXin LI.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
229a9ea25fSXin LI.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
239a9ea25fSXin LI.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
249a9ea25fSXin LI.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
259a9ea25fSXin LI.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
269a9ea25fSXin LI.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
279a9ea25fSXin LI.\" SUCH DAMAGE.
289a9ea25fSXin LI.\"
299a9ea25fSXin LI.\" $FreeBSD$
30bca072afSXin LI.Dd June 6, 2007
319a9ea25fSXin LI.Dt GZIP 1
329a9ea25fSXin LI.Os
339a9ea25fSXin LI.Sh NAME
349a9ea25fSXin LI.Nm gzip
359a9ea25fSXin LI.Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
369a9ea25fSXin LI.Sh SYNOPSIS
379a9ea25fSXin LI.Nm
382a8e7ac9SXin LI.Op Fl cdfhkLlNnqrtVv
399a9ea25fSXin LI.Op Fl S Ar suffix
409a9ea25fSXin LI.Ar file
419a9ea25fSXin LI.Oo
429a9ea25fSXin LI.Ar file Oo ...
439a9ea25fSXin LI.Oc
449a9ea25fSXin LI.Oc
459a9ea25fSXin LI.Nm gunzip
46bca072afSXin LI.Op Fl cfhkLNqrtVv
479a9ea25fSXin LI.Op Fl S Ar suffix
489a9ea25fSXin LI.Ar file
499a9ea25fSXin LI.Oo
509a9ea25fSXin LI.Ar file Oo ...
519a9ea25fSXin LI.Oc
529a9ea25fSXin LI.Oc
539a9ea25fSXin LI.Nm zcat
549a9ea25fSXin LI.Op Fl fhV
559a9ea25fSXin LI.Ar file
569a9ea25fSXin LI.Oo
579a9ea25fSXin LI.Ar file Oo ...
589a9ea25fSXin LI.Oc
599a9ea25fSXin LI.Oc
609a9ea25fSXin LI.Sh DESCRIPTION
619a9ea25fSXin LIThe
629a9ea25fSXin LI.Nm
639a9ea25fSXin LIprogram compresses and decompresses files using Lempel-Ziv coding
649a9ea25fSXin LI(LZ77).
659a9ea25fSXin LIIf no
669a9ea25fSXin LI.Ar files
679a9ea25fSXin LIare specified,
689a9ea25fSXin LI.Nm
699a9ea25fSXin LIwill compress from standard input, or decompress to standard output.
709a9ea25fSXin LIWhen in compression mode, each
719a9ea25fSXin LI.Ar file
729a9ea25fSXin LIwill be replaced with another file with the suffix, set by the
739a9ea25fSXin LI.Fl S Ar suffix
749a9ea25fSXin LIoption, added, if possible.
759a9ea25fSXin LIIn decompression mode, each
769a9ea25fSXin LI.Ar file
779a9ea25fSXin LIwill be checked for existence, as will the file with the suffix
789a9ea25fSXin LIadded.
799a9ea25fSXin LI.Pp
809a9ea25fSXin LIIf invoked as
819a9ea25fSXin LI.Nm gunzip
829a9ea25fSXin LIthen the
839a9ea25fSXin LI.Fl d
849a9ea25fSXin LIoption is enabled.
859a9ea25fSXin LIIf invoked as
869a9ea25fSXin LI.Nm zcat
879a9ea25fSXin LIor
889a9ea25fSXin LI.Nm gzcat
899a9ea25fSXin LIthen both the
909a9ea25fSXin LI.Fl c
919a9ea25fSXin LIand
929a9ea25fSXin LI.Fl d
939a9ea25fSXin LIoptions are enabled.
949a9ea25fSXin LI.Pp
959a9ea25fSXin LIThis version of
969a9ea25fSXin LI.Nm
979a9ea25fSXin LIis also capable of decompressing files compressed using
989a9ea25fSXin LI.Xr compress 1
999a9ea25fSXin LIor
1009a9ea25fSXin LI.Xr bzip2 1 .
1019a9ea25fSXin LI.Sh OPTIONS
1029a9ea25fSXin LIThe following options are available:
1039a9ea25fSXin LI.Bl -tag -width XXrXXXrecursiveX
1049a9ea25fSXin LI.It Fl 1 , -fast
1059a9ea25fSXin LI.It Fl 2 , 3 , 4 , 5 , 6 , 7 , 8
1069a9ea25fSXin LI.It Fl 9 , -best
1079a9ea25fSXin LIThese options change the compression level used, with the
1089a9ea25fSXin LI.Fl 1
1099a9ea25fSXin LIoption being the fastest, with less compression, and the
1109a9ea25fSXin LI.Fl 9
1119a9ea25fSXin LIoption being the slowest, with optimal compression.
1129a9ea25fSXin LIThe default compression level is 6.
1139a9ea25fSXin LI.It Fl c , -stdout , -to-stdout
1149a9ea25fSXin LIThis option specifies that output will go to the standard output
1159a9ea25fSXin LIstream, leaving files intact.
1169a9ea25fSXin LI.It Fl d , -decompress , -uncompress
1179a9ea25fSXin LIThis option selects decompression rather than compression.
1189a9ea25fSXin LI.It Fl f , -force
1199a9ea25fSXin LIThis option turns on force mode.
1209a9ea25fSXin LIThis allows files with multiple links, overwriting of pre-existing
1219a9ea25fSXin LIfiles, reading from or writing to a terminal, and when combined
1229a9ea25fSXin LIwith the
1239a9ea25fSXin LI.Fl c
1249a9ea25fSXin LIoption, allowing non-compressed data to pass through unchanged.
1259a9ea25fSXin LI.It Fl h , -help
1269a9ea25fSXin LIThis option prints a usage summary and exits.
1272a8e7ac9SXin LI.It Fl k , -keep
1282a8e7ac9SXin LIKeep (don't delete) input files during compression
1292a8e7ac9SXin LIor decompression.
1309a9ea25fSXin LI.It Fl L , -license
1319a9ea25fSXin LIThis option prints
1329a9ea25fSXin LI.Nm
1339a9ea25fSXin LIlicense.
1349a9ea25fSXin LI.It Fl l , -list
1359a9ea25fSXin LIThis option displays information about the file's compressed and
1369a9ea25fSXin LIuncompressed size, ratio, uncompressed name.
1379a9ea25fSXin LIWith the
1389a9ea25fSXin LI.Fl v
1399a9ea25fSXin LIoption, it also displays the compression method, CRC, date and time
1409a9ea25fSXin LIembedded in the file.
1419a9ea25fSXin LI.It Fl N , -name
1429a9ea25fSXin LIThis option causes the stored filename in the input file to be used
1439a9ea25fSXin LIas the output file.
1449a9ea25fSXin LI.It Fl n , -no-name
1459a9ea25fSXin LIThis option stops the filename from being stored in the output
1469a9ea25fSXin LIfile.
1479a9ea25fSXin LI.It Fl q , -quiet
1489a9ea25fSXin LIWith this option, no warnings or errors are printed.
1499a9ea25fSXin LI.It Fl r , -recursive
1509a9ea25fSXin LIThis option is used to
1519a9ea25fSXin LI.Nm
1529a9ea25fSXin LIthe files in a directory tree individually, using the
1539a9ea25fSXin LI.Xr fts 3
1549a9ea25fSXin LIlibrary.
1559a9ea25fSXin LI.It Fl S Ar suffix , Fl -suffix Ar suffix
1569a9ea25fSXin LIThis option changes the default suffix from .gz to
1579a9ea25fSXin LI.Ar suffix .
1589a9ea25fSXin LI.It Fl t , -test
1599a9ea25fSXin LIThis option will test compressed files for integrity.
1609a9ea25fSXin LI.It Fl V , -version
1619a9ea25fSXin LIThis option prints the version of the
1629a9ea25fSXin LI.Nm
1639a9ea25fSXin LIprogram.
1649a9ea25fSXin LI.It Fl v , -verbose
1659a9ea25fSXin LIThis option turns on verbose mode, which prints the compression
1669a9ea25fSXin LIratio for each file compressed.
1679a9ea25fSXin LI.El
1689a9ea25fSXin LI.Sh ENVIRONMENT
1699a9ea25fSXin LIIf the environment variable
1709a9ea25fSXin LI.Ev GZIP
1719a9ea25fSXin LIis set, it is parsed as a white-space separated list of options
1729a9ea25fSXin LIhandled before any options on the command line.
1739a9ea25fSXin LIOptions on the command line will override anything in
1749a9ea25fSXin LI.Ev GZIP .
1759a9ea25fSXin LI.Sh SEE ALSO
1769a9ea25fSXin LI.Xr bzip2 1 ,
1779a9ea25fSXin LI.Xr compress 1 ,
1789a9ea25fSXin LI.Xr fts 3 ,
1799a9ea25fSXin LI.Xr zlib 3
1809a9ea25fSXin LI.Sh HISTORY
1819a9ea25fSXin LIThe
1829a9ea25fSXin LI.Nm
1839a9ea25fSXin LIprogram was originally written by Jean-loup Gailly, licensed under
1849a9ea25fSXin LIthe GNU Public Licence.
1859a9ea25fSXin LIMatthew R. Green wrote a simple front end for
1869a9ea25fSXin LI.Nx 1.3
1879a9ea25fSXin LIdistribution media, based on the freely re-distributable zlib library.
1889a9ea25fSXin LIIt was enhanced to be mostly feature-compatible with the original
1899a9ea25fSXin LIGNU
1909a9ea25fSXin LI.Nm
1919a9ea25fSXin LIprogram for
1929a9ea25fSXin LI.Nx 2.0 .
1939a9ea25fSXin LI.Pp
1949a9ea25fSXin LIThis implementation of
1959a9ea25fSXin LI.Nm
1969a9ea25fSXin LIwas ported based on the
1979a9ea25fSXin LI.Nx
1989a9ea25fSXin LI.Nm
1999a9ea25fSXin LI20060927, and first appeared in
2009a9ea25fSXin LI.Fx 7.0 .
2019a9ea25fSXin LI.Sh AUTHORS
2029a9ea25fSXin LIThis implementation of
2039a9ea25fSXin LI.Nm
2049a9ea25fSXin LIwas written by
2059a9ea25fSXin LI.An Matthew R. Green Aq mrg@eterna.com.au .
2062bab61b0SXin LI.Sh BUGS
2072bab61b0SXin LIAccording to RFC 1952, the recorded file size is stored in a 32-bit
2082bab61b0SXin LIinteger and therefore it can not represent files that is bigger than
2092bab61b0SXin LI4GB in size.  This limitation also applies to
2102bab61b0SXin LI.Fl l
2112bab61b0SXin LIoption of
2122bab61b0SXin LI.Nm
2132bab61b0SXin LIutility.
214