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

NAME

6       compress, uncompress, zcat - compress and expand data (version 4.1)
7

SYNOPSIS

9       compress [ -f ] [ -v ] [ -c ] [ -V ] [ -r ] [ -b bits ] [ name ...  ]
10       uncompress [ -f ] [ -v ] [ -c ] [ -V ] [ name ...  ]
11       zcat [ -V ] [ 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.  Compress will only attempt to compress
19       regular files.  In particular, it will ignore symbolic links. If a file
20       has multiple hard links, compress will refuse to compress it unless the
21       -f flag is given.
22
23       If -f is not given and compress is run in the foreground, the  user  is
24       prompted as to whether an existing file should be overwritten.
25
26       Compressed  files  can  be restored to their original form using uncom‐
27       press or zcat.
28
29       uncompress takes a list of files on its command line and replaces  each
30       file  whose  name  ends with .Z and which begins with the correct magic
31       number with an uncompressed file without the .Z.  The uncompressed file
32       will have the mode, ownership and timestamps of the compressed file.
33
34       The  -c  option makes compress/uncompress write to the standard output;
35       no files are changed.
36
37       zcat is identical to uncompress -c.  zcat uncompresses either a list of
38       files  on  the command line or its standard input and writes the uncom‐
39       pressed data on standard output.  zcat will uncompress files that  have
40       the correct magic number whether they have a .Z suffix or not.
41
42       If  the -r flag is specified, compress will operate recursively. If any
43       of the file names specified on the command line are  directories,  com‐
44       press  will  descend  into  the directory and compress all the files it
45       finds there.
46
47       The -V flag tells each of these  programs  to  print  its  version  and
48       patchlevel, along with any preprocessor flags specified during compila‐
49       tion, on stderr before doing any compression or uncompression.
50
51       Compress uses the modified Lempel-Ziv algorithm popularized in "A Tech‐
52       nique for High Performance Data Compression", Terry A. Welch, IEEE Com‐
53       puter, vol. 17, no. 6 (June 1984), pp. 8-19.  Common substrings in  the
54       file  are  first  replaced by 9-bit codes 257 and up.  When code 512 is
55       reached, the algorithm switches to 10-bit codes and  continues  to  use
56       more  bits until the limit specified by the -b flag is reached (default
57       16).  Bits must be between 9 and 16.  The default can be changed in the
58       source to allow compress to be run on a smaller machine.
59
60       After the bits limit is attained, compress periodically checks the com‐
61       pression ratio.  If it is increasing, compress  continues  to  use  the
62       existing code dictionary.  However, if the compression ratio decreases,
63       compress discards the table of substrings and rebuilds it from scratch.
64       This allows the algorithm to adapt to the next "block" of the file.
65
66       Note that the -b flag is omitted for uncompress, since the bits parame‐
67       ter specified during compression is encoded within  the  output,  along
68       with a magic number to ensure that neither decompression of random data
69       nor recompression of compressed data is attempted.
70
71       The amount of compression obtained depends on the size  of  the  input,
72       the number of bits per code, and the distribution of common substrings.
73       Typically, text such as source code or English is  reduced  by  50-60%.
74       Compression is generally much better than that achieved by Huffman cod‐
75       ing (as used in pack), or adaptive Huffman coding (compact), and  takes
76       less time to compute.
77
78       Under  the  -v  option, a message is printed yielding the percentage of
79       reduction for each file compressed.
80
81       Exit status is normally 0; if the last file is larger after (attempted)
82       compression, the status is 2; if an error occurs, exit status is 1.
83

SEE ALSO

85       pack(1), compact(1)
86

DIAGNOSTICS

88       Usage: compress [-dfvcVr] [-b maxbits] [file ...]
89               Invalid options were specified on the command line.
90       Missing maxbits
91               Maxbits must follow -b.
92       file: not in compressed format
93               The file specified to uncompress has not been compressed.
94       file: compressed with xx bits, can only handle yy bits
95               File was compressed by a program that could deal with more bits
96               than the compress code on this machine.   Recompress  the  file
97               with smaller bits.
98       file: already has .Z suffix -- no change
99               The  file is assumed to be already compressed.  Rename the file
100               and try again.
101       file: filename too long to tack on .Z
102               The file cannot be compressed because its name is  longer  than
103               12  characters.   Rename  and try again.  This message does not
104               occur on BSD systems.
105       file already exists; do you wish to overwrite (y or n)?
106               Respond "y" if you want the output file to be replaced; "n"  if
107               not.
108       uncompress: corrupt input
109               A  SIGSEGV  violation was detected which usually means that the
110               input file has been corrupted.
111       Compression: xx.xx%
112               Percentage of the input saved by compression.   (Relevant  only
113               for -v.)
114       -- not a regular file or directory: ignored
115               When the input file is not a regular file or directory, (e.g. a
116               symbolic link, socket, FIFO, device file),  it  is  left  unal‐
117               tered.
118       -- has xx other links: unchanged
119               The  input file has links; it is left unchanged.  See ln(1) for
120               more information. Use the -f flag to force compression of  mul‐
121               tiply-linked files.
122       -- file unchanged
123               No  savings is achieved by compression.  The input remains vir‐
124               gin.
125

BUGS

127       Although compressed files are compatible between  machines  with  large
128       memory,  -b12  should be used for file transfer to architectures with a
129       small process data space (64KB or less, as exhibited  by  the  DEC  PDP
130       series, the Intel 80286, etc.)
131
132       Invoking  compress with a -r flag will occasionally cause it to produce
133       spurious error warnings of the form
134
135        "<filename>.Z already has .Z suffix - ignored"
136
137       These warnings can be ignored. See the comments in compress.c:compdir()
138       for an explanation.
139
140
141
142
143                                     local                         COMPRESS(1)
Impressum