maint: prefer HTTPS to HTTP, FTP in URLs
[debian/gzip] / doc / gzip.texi
index c7f8d62ad94c338c02e09b95468663c169f17c59..ca1e62378a1cbcf5d5e6cdd535176fda1ca5c373 100644 (file)
@@ -1,24 +1,25 @@
 \input texinfo @c -*-texinfo-*-
 @c %**start of header
 @setfilename gzip.info
+@documentencoding UTF-8
 @include version.texi
-@settitle Gzip User's Manual
+@settitle GNU Gzip
 @finalout
 @setchapternewpage odd
 @c %**end of header
 @copying
-This manual is for Gzip
+This manual is for GNU Gzip
 (version @value{VERSION}, @value{UPDATED}),
 and documents commands for compressing and decompressing data.
 
-Copyright @copyright{} 1998, 1999, 2001, 2002, 2006, 2007 Free
-Software Foundation, Inc.
+Copyright @copyright{} 1998-1999, 2001-2002, 2006-2007, 2009-2017 Free Software
+Foundation, Inc.
 
 Copyright @copyright{} 1992, 1993 Jean-loup Gailly
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2 or
+under the terms of the GNU Free Documentation License, Version 1.3 or
 any later version published by the Free Software Foundation; with no
 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
 Texts.  A copy of the license is included in the section entitled ``GNU
@@ -26,24 +27,26 @@ Free Documentation License''.
 @end quotation
 @end copying
 
-@c Debian install-info (up through at least version 1.9.20) uses only the
-@c first dircategory.  But install-info 1.10.28 rejects any attempt to
-@c put the more-useful individual utility first.  So put the less-useful
-@c general category first.
-@dircategory Utilities
+@dircategory Compression
 @direntry
-* Gzip: (gzip).                 The gzip command for compressing files.
+* Gzip: (gzip).                 General (de)compression of files (lzw).
 @end direntry
 
 @dircategory Individual utilities
 @direntry
-* gzip: (gzip)Invoking gzip.                    Compress files.
+* gunzip: (gzip)Overview.                       Decompression.
+* gzexe: (gzip)Overview.                        Compress executables.
+* zcat: (gzip)Overview.                         Decompression to stdout.
+* zdiff: (gzip)Overview.                        Compare compressed files.
+* zforce: (gzip)Overview.                       Force .gz extension on files.
+* zgrep: (gzip)Overview.                        Search compressed files.
+* zmore: (gzip)Overview.                        Decompression output by pages.
 @end direntry
 
 @titlepage
-@title gzip
+@title GNU gzip
 @subtitle The data compression program
-@subtitle for Gzip Version @value{VERSION}
+@subtitle for Gzip version @value{VERSION}
 @subtitle @value{UPDATED}
 @author by Jean-loup Gailly
 
@@ -56,7 +59,7 @@ Free Documentation License''.
 
 @ifnottex
 @node Top
-@top Compressing Files
+@top GNU Gzip: General file (de)compression
 
 @insertcopying
 @end ifnottex
@@ -69,21 +72,21 @@ Free Documentation License''.
 * Environment::                The @env{GZIP} environment variable
 * Tapes::               Using @command{gzip} on tapes.
 * Problems::           Reporting bugs.
-* Copying This Manual:: How to make copies of this manual.
-* Concept Index::      Index of concepts.
+* GNU Free Documentation License:: Copying and sharing this manual.
+* Concept index::       Index of concepts.
 @end menu
 
 @node Overview
 @chapter Overview
 @cindex overview
 
-@command{gzip} reduces the size of the named files using Lempel-Ziv coding
+@command{gzip} reduces the size of the named files using Lempel--Ziv coding
 (LZ77).  Whenever possible, each file is replaced by one with the
 extension @samp{.gz}, while keeping the same ownership modes, access and
-modification times.  (The default extension is @option{-gz} for @abbr{VMS},
+modification times.  (The default extension is
 @samp{z} for @abbr{MSDOS}, @abbr{OS/2} @abbr{FAT} and Atari.)
 If no files are specified or
-if a file name is "-", the standard input is compressed to the standard
+if a file name is @file{-}, the standard input is compressed to the standard
 output.  @command{gzip} will only attempt to compress regular files.  In
 particular, it will ignore symbolic links.
 
@@ -95,15 +98,15 @@ For example, if file names are limited to 14 characters, gzip.msdos.exe
 is compressed to gzi.msd.exe.gz.  Names are not truncated on systems
 which do not have a limit on file name length.
 
-By default, @command{gzip} keeps the original file name and time stamp in
+By default, @command{gzip} keeps the original file name and timestamp in
 the compressed file.  These are used when decompressing the file with the
 @option{-N} option.  This is useful when the compressed file name was
-truncated or when the time stamp was not preserved after a file
+truncated or when the timestamp was not preserved after a file
 transfer.  However, due to limitations in the current @command{gzip} file
-format, fractional seconds are discarded.  Also, time stamps must fall
-within the range 1970-01-01 00:00:00 through 2106-02-07 06:28:15
-@abbr{UTC}, and hosts whose operating systems use 32-bit time
-stamps are further restricted to time stamps no later than 2038-01-19
+format, fractional seconds are discarded.  Also, timestamps must fall
+within the range 1970-01-01 00:00:01 through 2106-02-07 06:28:15
+@abbr{UTC}, and hosts whose operating systems use 32-bit timestamps
+are further restricted to timestamps no later than 2038-01-19
 03:14:07 @abbr{UTC}.  The upper bounds assume the typical case
 where leap seconds are ignored.
 
@@ -113,8 +116,9 @@ compressed file is not suitable for its file system, a new name is
 constructed from the original one to make it legal.
 
 @command{gunzip} takes a list of files on its command line and replaces
-each file whose name ends with @samp{.gz}, @samp{.z}, @samp{.Z},
-@option{-gz}, @option{-z} or @samp{_z} and which begins with the correct
+each file whose name ends with @samp{.gz}, @samp{.z}
+@samp{-gz}, @samp{-z}, or @samp{_z} (ignoring case)
+and which begins with the correct
 magic number with an uncompressed file without the original extension.
 @command{gunzip} also recognizes the special extensions @samp{.tgz} and
 @samp{.taz} as shorthands for @samp{.tar.gz} and @samp{.tar.Z}
@@ -137,7 +141,7 @@ its input, and happily generates garbage output.  The @abbr{SCO} @samp{compress
 also allows some consistency checks.
 
 Files created by @command{zip} can be uncompressed by @command{gzip} only if
-they have a single member compressed with the 'deflation' method.  This
+they have a single member compressed with the ``deflation'' method.  This
 feature is only intended to help conversion of @file{tar.zip} files to
 the @file{tar.gz} format.  To extract a @command{zip} file with a single
 member, use a command like @samp{gunzip <foo.zip} or @samp{gunzip -S
@@ -150,11 +154,11 @@ input and writes the uncompressed data on standard output.  @command{zcat}
 will uncompress files that have the correct magic number whether they
 have a @samp{.gz} suffix or not.
 
-@command{gzip} uses the Lempel-Ziv algorithm used in @command{zip} and
+@command{gzip} uses the Lempel--Ziv algorithm used in @command{zip} and
 @abbr{PKZIP}@.
 The amount of compression obtained depends on the size of the input and
 the distribution of common substrings.  Typically, text such as source
-code or English is reduced by 60-70%.  Compression is generally much
+code or English is reduced by 60--70%.  Compression is generally much
 better than that achieved by @abbr{LZW} (as used in @command{compress}), Huffman
 coding (as used in @command{pack}), or adaptive Huffman coding
 (@command{compact}).
@@ -164,18 +168,18 @@ larger than the original.  The worst case expansion is a few bytes for
 the @command{gzip} file header, plus 5 bytes every 32K block, or an expansion
 ratio of 0.015% for large files.  Note that the actual number of used
 disk blocks almost never increases.  @command{gzip} normally preserves the mode,
-ownership and time stamps of files when compressing or decompressing.
+ownership and timestamps of files when compressing or decompressing.
 
-The @command{gzip} file format is specified in P. Deutsch, @sc{gzip} file
+The @command{gzip} file format is specified in P. Deutsch, GZIP file
 format specification version 4.3,
-@uref{ftp://ftp.isi.edu/in-notes/rfc1952.txt, Internet @abbr{RFC} 1952} (May
+@uref{https://www.ietf.org/rfc/rfc1952.txt, Internet @abbr{RFC} 1952} (May
 1996).  The @command{zip} deflation format is specified in P. Deutsch,
-@sc{deflate} Compressed Data Format Specification version 1.3,
-@uref{ftp://ftp.isi.edu/in-notes/rfc1951.txt, Internet @abbr{RFC} 1951} (May
+DEFLATE Compressed Data Format Specification version 1.3,
+@uref{https://www.ietf.org/rfc/rfc1951.txt, Internet @abbr{RFC} 1951} (May
 1996).
 
 @node Sample
-@chapter Sample Output
+@chapter Sample output
 @cindex sample
 
 Here are some realistic examples of running @command{gzip}.
@@ -192,13 +196,16 @@ Mandatory arguments to long options are mandatory for short options too.
   -d, --decompress  decompress
   -f, --force       force overwrite of output file and compress links
   -h, --help        give this help
+  -k, --keep        keep (don't delete) input files
   -l, --list        list compressed file contents
   -L, --license     display software license
-  -n, --no-name     do not save or restore the original name and time stamp
-  -N, --name        save or restore the original name and time stamp
+  -n, --no-name     do not save or restore the original name and timestamp
+  -N, --name        save or restore the original name and timestamp
   -q, --quiet       suppress all warnings
   -r, --recursive   operate recursively on directories
+      --rsyncable   make rsync-friendly archive
   -S, --suffix=SUF  use suffix SUF on compressed files
+      --synchronous synchronous output (safer if system crashes, but slower)
   -t, --test        test compressed file integrity
   -v, --verbose     verbose mode
   -V, --version     display version number
@@ -225,7 +232,7 @@ stopping on the first failure:
 find . -name '*
 *' -prune -o -name '*.gz' -type f -print |
   sed "
-    s/'/'\\''/g
+    s/'/'\\\\''/g
     s/^\\(.*\\)\\.gz$/gunzip <'\\1.gz' >'\\1'/
   " |
   sh -e
@@ -273,6 +280,10 @@ whether an existing file should be overwritten.
 @itemx -h
 Print an informative help message describing the options then quit.
 
+@item --keep
+@itemx -k
+Keep (don't delete) input files during compression or decompression.
+
 @item --list
 @itemx -l
 For each compressed file, list the following fields:
@@ -298,7 +309,7 @@ displayed:
 @example
 method: compression method (deflate,compress,lzh,pack)
 crc: the 32-bit CRC of the uncompressed data
-date & time: time stamp for the uncompressed file
+date & time: timestamp for the uncompressed file
 @end example
 
 The @abbr{CRC} is given as ffffffff for a file not in gzip format.
@@ -323,20 +334,20 @@ Display the @command{gzip} license then quit.
 
 @item --no-name
 @itemx -n
-When compressing, do not save the original file name and time stamp by
+When compressing, do not save the original file name and timestamp by
 default.  (The original name is always saved if the name had to be
 truncated.)  When decompressing, do not restore the original file name
 if present (remove only the @command{gzip}
 suffix from the compressed file name) and do not restore the original
-time stamp if present (copy it from the compressed file).  This option
+timestamp if present (copy it from the compressed file).  This option
 is the default when decompressing.
 
 @item --name
 @itemx -N
-When compressing, always save the original file name and time stamp; this
+When compressing, always save the original file name and timestamp; this
 is the default.  When decompressing, restore the original file name and
-time stamp if present.  This option is useful on systems which have
-a limit on file name length or when the time stamp has been lost after
+timestamp if present.  This option is useful on systems which have
+a limit on file name length or when the timestamp has been lost after
 a file transfer.
 
 @item --quiet
@@ -350,6 +361,13 @@ specified on the command line are directories, @command{gzip} will descend
 into the directory and compress all the files it finds there (or
 decompress them in the case of @command{gunzip}).
 
+@item --rsyncable
+Cater better to the @command{rsync} program by periodically resetting
+the internal structure of the compressed data stream.  This lets the
+@code{rsync} program take advantage of similarities in the uncompressed
+input when synchronizing two files compressed with this flag.  The cost:
+the compressed output is usually about one percent larger.
+
 @item --suffix @var{suf}
 @itemx -S @var{suf}
 Use suffix @var{suf} instead of @samp{.gz}.  Any suffix can be
@@ -365,6 +383,16 @@ gunzip -S "" *        (*.* for MSDOS)
 Previous versions of gzip used the @samp{.z} suffix.  This was changed to
 avoid a conflict with @command{pack}.
 
+@item --synchronous
+Use synchronous output, by transferring output data to the output
+file's storage device when the file system supports this.  Because
+file system data can be cached, without this option if the system
+crashes around the time a command like @samp{gzip FOO} is run the user
+might lose both @file{FOO} and @file{FOO.gz}; this is the default with
+@command{gzip}, just as it is the default with most applications that
+move data.  When this option is used, @command{gzip} is safer but can
+be considerably slower.
+
 @item --test
 @itemx -t
 Test.  Check the compressed file integrity.
@@ -460,19 +488,25 @@ complement to @command{tar}, not as a replacement.
 @chapter Environment
 @cindex Environment
 
-The environment variable @env{GZIP} can hold a set of default options for
-@command{gzip}.  These options are interpreted first and can be overwritten by
-explicit command line parameters.  For example:
+The obsolescent environment variable @env{GZIP} can hold a set of
+default options for @command{gzip}.  These options are interpreted
+first and can be overwritten by explicit command line parameters.  As
+this can cause problems when using scripts, this feature is supported
+only for options that are reasonably likely to not cause too much
+harm, and @command{gzip} warns if it is used.  This feature will be
+removed in a future release of @command{gzip}.
+
+You can use an alias or script instead.  For example, if
+@command{gzip} is in the directory @samp{/usr/bin} you can prepend
+@file{$HOME/bin} to your @env{PATH} and create an executable script
+@file{$HOME/bin/gzip} containing the following:
 
 @example
-for sh:    GZIP="-8v --name"; export GZIP
-for csh:   setenv GZIP "-8v --name"
-for MSDOS: set GZIP=-8v --name
+#! /bin/sh
+export PATH=/usr/bin
+exec gzip -9 "$@@"
 @end example
 
-On @abbr{VMS}, the name of the environment variable is @env{GZIP_OPT}, to
-avoid a conflict with the symbol set for invocation of the program.
-
 @node Tapes
 @chapter Using @command{gzip} on tapes
 @cindex tapes
@@ -482,21 +516,8 @@ the output with zeroes up to a block boundary.  When the data is read and
 the whole block is passed to @command{gunzip} for decompression,
 @command{gunzip} detects that there is extra trailing garbage after the
 compressed data and emits a warning by default if the garbage contains
-nonzero bytes.  You have to use the
-@option{--quiet} option to suppress the warning.  This option can be set in the
-@env{GZIP} environment variable, as in:
-
-@example
-for sh:    GZIP="-q"  tar -xfz --block-compress /dev/rst0
-for csh:   (setenv GZIP "-q"; tar -xfz --block-compress /dev/rst0)
-@end example
-
-In the above example, @command{gzip} is invoked implicitly by the @option{-z}
-option of @acronym{GNU} @command{tar}.  Make sure that the same block
-size (@option{-b}
-option of @command{tar}) is used for reading and writing compressed data on
-tapes.  (This example assumes you are using the @acronym{GNU} version of
-@command{tar}.)
+nonzero bytes.  You can use the @option{--quiet} option to suppress
+the warning.
 
 @node Problems
 @chapter Reporting Bugs
@@ -511,17 +532,13 @@ a description of the bug behavior, and the input to @command{gzip}
 that triggered
 the bug.@refill
 
-@node Copying This Manual
-@appendix Copying This Manual
-
-@menu
-* GNU Free Documentation License::  License for copying this manual.
-@end menu
+@node GNU Free Documentation License
+@appendix GNU Free Documentation License
 
 @include fdl.texi
 
-@node Concept Index
-@appendix Concept Index
+@node Concept index
+@appendix Concept index
 
 @printindex cp