unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

COMPRESS(1)                 General Commands Manual                COMPRESS(1)



NAME
       compress, uncompress, zcat - compress or expand files, display expanded
       contents

SYNOPSIS
       compress [ -cfv ] [ -b bits ] [ filename...  ]

       uncompress [ -cv ] [ filename...  ]

       zcat [ filename...  ]

DESCRIPTION
       compress reduces the size of the named files using adaptive  Lempel-Ziv
       coding.   Whenever  possible,  each  file  is  replaced by one with the
       extension .Z, while keeping the  same  ownership  modes,   as  well  as
       access and modification times.  If no files are specified, the standard
       input is compressed to the standard output.

       The amount of compression obtained depends on the size  of  the  input,
       the number of bits per code, and the distribution of common substrings.
       Typically, text such as source code or English is  reduced  by  50-60%.
       Compression is generally much better than that achieved by Huffman cod-
       ing (as used in sys-unconfig(8)), or adaptive Huffman coding  (old-com-
       pact(1)), and takes less time to compute.  The bits parameter specified
       during compression is encoded within the compressed file, along with  a
       magic  number  to  ensure that neither decompression of random data nor
       recompression of compressed data is subsequently allowed.

       Compressed files can be restored to their original  form  using  uncom-
       press.

       zcat  produces  uncompressed  output on the standard output, but leaves
       the compressed .Z file intact.

OPTIONS
       -c     Write to the standard output; no files are changed.  The  nonde-
              structive  behavior  of zcat is identical to that of `uncompress
              -c'.

       -f     Force compression, even if the file does not actually shrink, or
              the  corresponding  .Z file already exists.  Except when running
              in the background (under sh(1)), if -f is not given,  prompt  to
              verify whether an existing .Z file should be overwritten.

       -v     Verbose.   Display  the  percentage reduction for each file com-
              pressed.

       -b bits
              Set the upper limit (in bits) for common substring codes.   bits
              must be between 9 and 16 (16 is the default).

SEE ALSO
       ln(1V), old-compact(1), sh(1), sys-unconfig(8)

       A Technique for High Performance Data Compression, Terry A. Welch, com-
       puter, vol. 17, no. 6 (June 1984), pp. 8-19.

DIAGNOSTICS
       Exit status is normally 0.  If the last file was not compressed because
       it  became larger, the status is 2.  If an error occurs, exit status is
       1.

       Usage: compress [-fvc] [-b maxbits] [filename...]
                 Invalid options were specified on the command line.

       Missing maxbits
                 Maxbits must follow -b .

       filename: not in compressed format
                 The file specified to uncompress has not been compressed.

       filename: compressed with xxbits, can only handle yybits
                 filename was compressed by a program  that  could  deal  with
                 more bits than the compress code on this machine.  Recompress
                 the file with smaller bits.

       filename: already has .Z suffix -- no change
                 The file is assumed to be  already  compressed.   Rename  the
                 file and try again.

       filename: already exists; do you wish to overwrite (y or n)?
                 Respond  y  if  you want the output file to be replaced; n if
                 not.

       uncompress: corrupt input
                 A SIGSEGV violation was detected, which  usually  means  that
                 the input file is corrupted.

       Compression:  xx.xx%
                 Percentage of the input saved by compression.  (Relevant only
                 for -v.)

       -- not a regular file: unchanged
                 When the input file is not a regular file, (such as a  direc-
                 tory), it is left unaltered.

       -- has xx other links: unchanged
                 The  input  file has links; it is left unchanged.  See ln(1V)
                 for more information.

       -- file unchanged
                 No savings are achieved by compression.   The  input  remains
                 uncompressed.

BUGS
       Although  compressed  files  are compatible between machines with large
       memory, -b12 should be used for file transfer to architectures  with  a
       small process data space (64KB or less).

       compress should be more flexible about the existence of the .Z suffix.



                               9 September 1987                    COMPRESS(1)