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 ] [ -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

DIAGNOSTICS

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

BUGS

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

SEE ALSO

138       pack(1), compact(1)
139
140
141
142                                     local                         COMPRESS(1)
Impressum