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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

DIAGNOSTICS

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

BUGS

133       Although  compressed  files  are compatible between machines with large
134       memory, -b12 should be used for file transfer to architectures  with  a
135       small process data space (64KB or less, as exhibited by the DEC PDP se‐
136       ries, the Intel 80286, etc.)
137

SEE ALSO

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