home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / gz124-16.zip / gzip.doc < prev    next >
Text File  |  1993-08-18  |  16KB  |  351 lines

  1.  
  2. GZIP(1)                  USER COMMANDS                    GZIP(1)
  3.  
  4. NAME
  5.      gzip, gunzip, zcat - compress or expand files
  6.  
  7. SYNOPSIS
  8.      gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]
  9.      gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
  10.      zcat [ -fhLV ] [ name ... ]
  11.  
  12. DESCRIPTION
  13.      Gzip reduces the size of the named  files  using  Lempel-Ziv
  14.      coding  (LZ77).  Whenever possible, each file is replaced by
  15.      one with the extension .gz, while keeping the same ownership
  16.      modes,  access  and modification times.  (The default exten-
  17.      sion is -gz for VMS, z for MSDOS, OS/2 FAT, Windows  NT  FAT
  18.      and  Atari.) If no files are specified, or if a file name is
  19.      "-", the standard input is compressed to the  standard  out-
  20.      put.   Gzip will only attempt to compress regular files.  In
  21.      particular, it will ignore symbolic links.
  22.  
  23.      If the compressed file name is too long for its file system,
  24.      gzip truncates it.  Gzip attempts to truncate only the parts
  25.      of the file name longer than 3 characters.  (A part is  del-
  26.      imited  by  dots.) If the name consists of small parts only,
  27.      the longest parts are truncated. For example, if file  names
  28.      are  limited  to 14 characters, gzip.msdos.exe is compressed
  29.      to gzi.msd.exe.gz.  Names are not truncated on systems which
  30.      do not have a limit on file name length.
  31.  
  32.      By default, gzip keeps the original file name and  timestamp
  33.      in  the  compressed  file. These are used when decompressing
  34.      the file with  the  -N  option.  This  is  useful  when  the
  35.      compressed  file  name  was truncated or when the time stamp
  36.      was not preserved after a file transfer.
  37.  
  38.      Compressed files can be  restored  to  their  original  form
  39.      using  gzip -d or gunzip or zcat. If the original name saved
  40.      in the compressed file is not suitable for its file  system,
  41.      a  new  name is constructed from the original one to make it
  42.      legal.
  43.  
  44.      gunzip takes a  list  of  files  on  its  command  line  and
  45.      replaces each file whose name ends with .gz, -gz, .z, -z, _z
  46.      or .Z and which begins with the correct magic number with an
  47.      uncompressed  file  without  the original extension.  gunzip
  48.      also recognizes the special  extensions  .tgz  and  .taz  as
  49.      shorthands   for  .tar.gz  and  .tar.Z  respectively.   When
  50.      compressing, gzip  uses  the  .tgz  extension  if  necessary
  51.      instead of truncating a file with a .tar extension.
  52.  
  53.      gunzip can currently decompress files created by gzip,  zip,
  54.      compress,  compress  -H  or pack. The detection of the input
  55.      format is automatic.  When  using  the  first  two  formats,
  56.      gunzip  checks  a  32  bit  CRC. For pack, gunzip checks the
  57.      uncompressed length. The standard compress  format  was  not
  58.      designed  to  allow  consistency  checks.  However gunzip is
  59.      sometimes able to detect a bad .Z file. If you get an  error
  60.      when uncompressing a .Z file, do not assume that the .Z file
  61.      is correct simply because the standard uncompress  does  not
  62.      complain.  This generally means that the standard uncompress
  63.      does not check its input, and happily generates garbage out-
  64.      put.   The  SCO  compress -H format (lzh compression method)
  65.      does not include a CRC  but  also  allows  some  consistency
  66.      checks.
  67.  
  68.      Files created by zip can be uncompressed  by  gzip  only  if
  69.      they  have  a  single member compressed with the 'deflation'
  70.      method. This feature is only intended to help conversion  of
  71.      tar.zip  files  to  the  tar.gz format. To extract zip files
  72.      with several members, use unzip instead of gunzip.
  73.  
  74.      zcat is identical to gunzip -c. (On some systems,  zcat  may
  75.      be  installed  as  gzcat  to  preserve  the original link to
  76.      compress.) zcat uncompresses either a list of files  on  the
  77.      command   line   or   its  standard  input  and  writes  the
  78.      uncompressed data on standard output.  zcat will  uncompress
  79.      files that have the correct magic number whether they have a
  80.      .gz suffix or not.
  81.  
  82.      Gzip uses the Lempel-Ziv algorithm used in  zip  and  PKZIP.
  83.      The  amount  of  compression obtained depends on the size of
  84.      the input and the distribution of common substrings.   Typi-
  85.      cally,  text  such  as  source code or English is reduced by
  86.      60-70%.  Compression is  generally  much  better  than  that
  87.      achieved  by  LZW  (as used in compress), Huffman coding (as
  88.      used in pack), or adaptive Huffman coding (compact).
  89.  
  90.      Compression is always performed, even if the compressed file
  91.      is  slightly larger than the original. The worst case expan-
  92.      sion is a few bytes for the gzip file header, plus  5  bytes
  93.      every  32K  block, or an expansion ratio of 0.015% for large
  94.      files. Note that the  actual  number  of  used  disk  blocks
  95.      almost  never increases.  gzip preserves the mode, ownership
  96.      and timestamps of files when compressing or decompressing.
  97.  
  98. OPTIONS
  99.      -a --ascii
  100.           Ascii text mode: convert end-of-lines using local  con-
  101.           ventions.  This  option  is supported only on some non-
  102.           Unix systems. For MSDOS, CR LF is converted to LF  when
  103.           compressing,   and  LF  is  converted  to  CR  LF  when
  104.           decompressing.
  105.  
  106.      -c --stdout --to-stdout
  107.           Write output on standard output;  keep  original  files
  108.           unchanged.   If there are several input files, the out-
  109.           put consists of a sequence of independently  compressed
  110.           members.  To obtain better compression, concatenate all
  111.           input files before compressing them.
  112.  
  113.      -d --decompress --uncompress
  114.           Decompress.
  115.  
  116.      -f --force
  117.           Force compression or decompression even if the file has
  118.           multiple   links  or  the  corresponding  file  already
  119.           exists, or if the compressed data is read from or writ-
  120.           ten to a terminal. If the input data is not in a format
  121.           recognized by gzip, and if the option --stdout is  also
  122.           given,  copy the input data without change to the stan-
  123.           dard ouput: let zcat behave as cat. If -f is not given,
  124.           and when not running in the background, gzip prompts to
  125.           verify whether an existing file should be overwritten.
  126.  
  127.      -h --help
  128.           Display a help screen and quit.
  129.  
  130.      -l --list
  131.           For each compressed file, list the following fields:
  132.  
  133.               compressed size: size of the compressed file
  134.               uncompressed size: size of the uncompressed file
  135.               ratio: compression ratio (0.0% if unknown)
  136.               uncompressed_name: name of the uncompressed file
  137.  
  138.           The uncompressed size is given as -1 for files  not  in
  139.           gzip  format,  such  as compressed .Z files. To get the
  140.           uncompressed size for such a file, you can use:
  141.  
  142.               zcat file.Z | wc -c
  143.  
  144.           In combination with the --verbose option, the following
  145.           fields are also displayed:
  146.  
  147.               method: compression method
  148.               crc: the 32-bit CRC of the uncompressed data
  149.               date & time: time stamp for the uncompressed file
  150.  
  151.           The  compression  methods   currently   supported   are
  152.           deflate, compress, lzh (SCO compress -H) and pack.  The
  153.           crc is given as ffffffff for a file not in gzip format.
  154.  
  155.           With --name, the uncompressed name,  date and time  are
  156.           those stored within the compress file if present.
  157.  
  158.           With --verbose, the size totals and  compression  ratio
  159.           for  all files is also displayed, unless some sizes are
  160.           unknown. With --quiet, the title and totals  lines  are
  161.           not displayed.
  162.  
  163.      -L --license
  164.           Display the gzip license and quit.
  165.  
  166.      -n --no-name
  167.           When compressing, do not save the  original  file  name
  168.           and time stamp by default. (The original name is always
  169.           saved  if  the  name  had  to   be   truncated.)   When
  170.           decompressing, do not restore the original file name if
  171.           present  (remove  only  the  gzip   suffix   from   the
  172.           compressed  file  name) and do not restore the original
  173.           time stamp if present  (copy  it  from  the  compressed
  174.           file). This option is the default when decompressing.
  175.  
  176.      -N --name
  177.           When compressing, always save the  original  file  name
  178.           and  time  stamp; this is the default. When decompress-
  179.           ing, restore the original file name and time  stamp  if
  180.           present.  This option is useful on systems which have a
  181.           limit on file name length or when the  time  stamp  has
  182.           been lost after a file transfer.
  183.  
  184.      -q --quiet
  185.           Suppress all warnings.
  186.  
  187.      -r --recursive
  188.           Travel the directory structure recursively. If  any  of
  189.           the file names specified on the command line are direc-
  190.           tories,  gzip  will  descend  into  the  directory  and
  191.           compress  all  the  files it finds there (or decompress
  192.           them in the case of gunzip ).
  193.  
  194.      -S .suf --suffix .suf
  195.           Use suffix .suf instead  of  .gz.  Any  suffix  can  be
  196.           given,  but  suffixes  other  than .z and .gz should be
  197.           avoided to avoid confusion when files  are  transferred
  198.           to  other systems.  A null suffix forces gunzip to  try
  199.           decompression on all given files regardless of  suffix,
  200.           as in:
  201.  
  202.               gunzip -S "" *       (*.* for MSDOS)
  203.  
  204.           Previous versions of gzip used the .z suffix. This  was
  205.           changed to avoid a conflict with pack(1).
  206.  
  207.      -t --test
  208.           Test. Check the compressed file integrity.
  209.  
  210.      -v --verbose
  211.           Verbose. Display the name and percentage reduction  for
  212.           each file compressed or decompressed.
  213.  
  214.      -V --version
  215.           Version. Display the  version  number  and  compilation
  216.           options then quit.
  217.  
  218.      -# --fast --best
  219.           Regulate the speed of compression using  the  specified
  220.           digit  #,  where  -1  or  --fast  indicates the fastest
  221.           compression method (less compression) and -9 or  --best
  222.           indicates the slowest compression method (best compres-
  223.           sion).  The default compression level is -6  (that  is,
  224.           biased towards high compression at expense of speed).
  225.  
  226. ADVANCED USAGE
  227.      Multiple compressed files can be concatenated. In this case,
  228.      gunzip will extract all members at once. For example:
  229.  
  230.            gzip -c file1  > foo.gz
  231.            gzip -c file2 >> foo.gz
  232.  
  233.      Then
  234.            gunzip -c foo
  235.  
  236.      is equivalent to
  237.  
  238.            cat file1 file2
  239.  
  240.      In case of damage to one member of a .gz file, other members
  241.      can  still  be recovered (if the damaged member is removed).
  242.      However, you can get better compression by  compressing  all
  243.      members at once:
  244.  
  245.            cat file1 file2 | gzip > foo.gz
  246.  
  247.      compresses better than
  248.  
  249.            gzip -c file1 file2 > foo.gz
  250.  
  251.      If you want to recompress concatenated files to  get  better
  252.      compression, do:
  253.  
  254.            gzip -cd old.gz | gzip > new.gz
  255.  
  256.      If a  compressed  file  consists  of  several  members,  the
  257.      uncompressed  size  and  CRC  reported  by the --list option
  258.      applies  to  the  last  member  only.  If   you   need   the
  259.      uncompressed size for all members, you can use:
  260.  
  261.            gzip -cd file.gz | wc -c
  262.  
  263.      If you wish to create a single archive  file  with  multiple
  264.      members  so  that  members  can  later be extracted indepen-
  265.      dently, use an archiver such as tar or zip. GNU tar supports
  266.      the -z option to invoke gzip transparently. gzip is designed
  267.      as a complement to tar, not as a replacement.
  268.  
  269. ENVIRONMENT
  270.      The environment variable GZIP can  hold  a  set  of  default
  271.      options  for  gzip.  These options are interpreted first and
  272.      can be overwritten by explicit command line parameters.  For
  273.      example:
  274.            for sh:    GZIP="-8v --name"; export GZIP
  275.            for csh:   setenv GZIP "-8v --name"
  276.            for MSDOS: set GZIP=-8v --name
  277.  
  278.      On  Vax/VMS,  the  name  of  the  environment  variable   is
  279.      GZIP_OPT,  to avoid a conflict with the symbol set for invo-
  280.      cation of the program.
  281.  
  282. SEE ALSO
  283.      znew(1), zcmp(1),  zmore(1),  zforce(1),  gzexe(1),  zip(1),
  284.      unzip(1), compress(1), pack(1), compact(1)
  285.  
  286. DIAGNOSTICS
  287.      Exit status is normally 0; if an error occurs,  exit  status
  288.      is 1. If a warning occurs, exit status is 2.
  289.  
  290.      Usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
  291.              Invalid options were specified on the command line.
  292.      file: not in gzip format
  293.              The  file  specified  to   gunzip   has   not   been
  294.              compressed.
  295.      file: Corrupt input. Use zcat to recover some data.
  296.              The compressed file has been damaged. The data up to
  297.              the point of failure can be recovered using
  298.                      zcat file > recover
  299.      file: compressed with xx bits, can only handle yy bits
  300.              File was compressed (using LZW) by  a  program  that
  301.              could  deal  with more bits than the decompress code
  302.              on this machine.  Recompress  the  file  with  gzip,
  303.              which compresses better and uses less memory.
  304.      file: already has .gz suffix -- no change
  305.              The  file  is  assumed  to  be  already  compressed.
  306.              Rename the file and try again.
  307.      file already exists; do you wish to overwrite (y or n)?
  308.              Respond "y" if  you  want  the  output  file  to  be
  309.              replaced; "n" if not.
  310.      gunzip: corrupt input
  311.              A SIGSEGV violation was detected which usually means
  312.              that the input file has been corrupted.
  313.      xx.x%
  314.              Percentage  of  the  input  saved  by   compression.
  315.              (Relevant only for -v and -l.)
  316.      -- not a regular file or directory: ignored
  317.              When the input file is not a regular file or  direc-
  318.              tory,  (e.g.  a  symbolic link, socket, FIFO, device
  319.              file), it is left unaltered.
  320.      -- has xx other links: unchanged
  321.              The input file has links; it is left unchanged.  See
  322.              ln(1) for more information. Use the -f flag to force
  323.              compression of multiply-linked files.
  324.  
  325. CAVEATS
  326.      When writing compressed data to  a  tape,  it  is  generally
  327.      necessary  to pad the output with zeroes up to a block boun-
  328.      dary. When the data is read and the whole block is passed to
  329.      gunzip for decompression, gunzip detects that there is extra
  330.      trailing garbage after the compressed data and emits a warn-
  331.      ing  by  default.  You  have  to  use  the --quiet option to
  332.      suppress the warning. This option can be  set  in  the  GZIP
  333.      environment variable as in:
  334.        for sh:  GZIP="-q"  tar -xfz --block-compress /dev/rst0
  335.        for csh: (setenv GZIP -q; tar -xfz --block-compr /dev/rst0
  336.  
  337.      In the above example, gzip is invoked implicitly by  the  -z
  338.      option  of  GNU  tar. Make sure that the same block size (-b
  339.      option of tar) is used for reading  and  writing  compressed
  340.      data  on tapes.  (This example assumes you are using the GNU
  341.      version of tar.)
  342.  
  343. BUGS
  344.      The --list option reports incorrect sizes if they  exceed  2
  345.      gigabytes.  The --list option reports sizes as -1 and crc as
  346.      ffffffff if the compressed file is on a non seekable media.
  347.  
  348.      In some rare cases, the --best option gives  worse  compres-
  349.      sion than the default compression level (-6). On some highly
  350.      redundant files, compress compresses better than gzip.
  351.