1COMPRESS(1)                 General Commands Manual                COMPRESS(1)
2
3
4

NAME

6       compress, uncompress, zcat - compress and expand data
7

SYNOPSIS

9       compress [ -f ] [ -v ] [ -c ] [ -b bits ] [ name ...  ]
10       uncompress [ -f ] [ -v ] [ -c ] [ name ...  ]
11       zcat [ name ...  ]
12

DESCRIPTION

14       Compress  reduces the size of the named files using adaptive Lempel-Ziv
15       coding.  Whenever possible, each file  is  replaced  by  one  with  the
16       extension  .Z, while keeping the same ownership modes, access and modi‐
17       fication times.  If no files are specified, the standard input is  com‐
18       pressed  to  the  standard output.  Compressed files can be restored to
19       their original form using uncompress or zcat.
20
21       The -f option will force compression of name, even if it does not actu‐
22       ally  shrink  or  the corresponding name.Z file already exists.  Except
23       when run in the background under /bin/sh, if -f is not given  the  user
24       is  prompted  as to whether an existing name.Z file should be overwrit‐
25       ten.
26
27       The -c (``cat'') option makes compress/uncompress write to the standard
28       output;  no  files are changed.  The nondestructive behavior of zcat is
29       identical to that of uncompress -c.
30
31       Compress uses the modified Lempel-Ziv algorithm popularized in "A Tech‐
32       nique for High Performance Data Compression", Terry A. Welch, IEEE Com‐
33       puter, vol. 17, no. 6 (June 1984), pp. 8-19.  Common substrings in  the
34       file  are  first  replaced by 9-bit codes 257 and up.  When code 512 is
35       reached, the algorithm switches to 10-bit codes and  continues  to  use
36       more  bits until the limit specified by the -b flag is reached (default
37       16).  Bits must be between 9 and 16.  The default can be changed in the
38       source to allow compress to be run on a smaller machine.
39
40       After the bits limit is attained, compress periodically checks the com‐
41       pression ratio.  If it is increasing, compress  continues  to  use  the
42       existing code dictionary.  However, if the compression ratio decreases,
43       compress discards the table of substrings and rebuilds it from scratch.
44       This allows the algorithm to adapt to the next "block" of the file.
45
46       Note that the -b flag is omitted for uncompress, since the bits parame‐
47       ter specified during compression is encoded within  the  output,  along
48       with a magic number to ensure that neither decompression of random data
49       nor recompression of compressed data is attempted.
50
51       The amount of compression obtained depends on the size  of  the  input,
52       the number of bits per code, and the distribution of common substrings.
53       Typically, text such as source code or English is  reduced  by  50-60%.
54       Compression is generally much better than that achieved by Huffman cod‐
55       ing (as used in pack), or adaptive Huffman coding (compact), and  takes
56       less time to compute.
57
58       The  -v  option causes the printing of the percentage reduction of each
59       file.
60
61       If an error occurs, exit status is 1, else if the  last  file  was  not
62       compressed  because  it became larger, the status is 2; else the status
63       is 0.
64

DIAGNOSTICS

66       Usage: compress [-fvc] [-b maxbits] [file ...]
67               Invalid options were specified on the command line.
68       Missing maxbits
69               Maxbits must follow -b.
70       file: not in compressed format
71               The file specified to uncompress has not been compressed.
72       file: compressed with xx bits, can only handle yy bits
73               File was compressed by a program that could deal with more bits
74               than  the  compress  code on this machine.  Recompress the file
75               with smaller bits.
76       file: already has .Z suffix -- no change
77               The file is assumed to be already compressed.  Rename the  file
78               and try again.
79       file: filename too long to tack on .Z
80               The  file  cannot be compressed because its name is longer than
81               12 characters.  Rename and try again.  This  message  does  not
82               occur on BSD systems.
83       file already exists; do you wish to overwrite (y or n)?
84               Respond  "y" if you want the output file to be replaced; "n" if
85               not.
86       uncompress: corrupt input
87               A SIGSEGV violation was detected which usually means  that  the
88               input file is corrupted.
89       Compression: xx.xx%
90               Percentage  of  the input saved by compression.  (Relevant only
91               for -v.)
92       -- not a regular file: unchanged
93               When the input file is not a regular file, (e.g. a  directory),
94               it is left unaltered.
95       -- has xx other links: unchanged
96               The  input file has links; it is left unchanged.  See ln(1) for
97               more information.
98       -- file unchanged
99               No savings is achieved by compression.  The input remains  vir‐
100               gin.
101

BUGS

103       Although  compressed  files  are compatible between machines with large
104       memory, -b12 should be used for file transfer to architectures  with  a
105       small  process  data  space  (64KB or less, as exhibited by the DEC PDP
106       series, the Intel 80286, etc.)
107
108       compress should be more flexible about the existence of the  `.Z'  suf‐
109       fix.
110
111
112
1134.3 Berkeley Distribution        May 11, 1986                      COMPRESS(1)
Impressum