Blame


1 cb58f329 2020-01-15 crossd .TH COMPRESS 1
2 cb58f329 2020-01-15 crossd .SH NAME
3 cb58f329 2020-01-15 crossd compress, uncompress, zcat \- compress and expand data
4 cb58f329 2020-01-15 crossd .SH SYNOPSIS
5 cb58f329 2020-01-15 crossd .B compress
6 cb58f329 2020-01-15 crossd [
7 cb58f329 2020-01-15 crossd .B \-f
8 cb58f329 2020-01-15 crossd ] [
9 cb58f329 2020-01-15 crossd .B \-v
10 cb58f329 2020-01-15 crossd ] [
11 cb58f329 2020-01-15 crossd .B \-c
12 cb58f329 2020-01-15 crossd ] [
13 cb58f329 2020-01-15 crossd .B \-V
14 cb58f329 2020-01-15 crossd ] [
15 cb58f329 2020-01-15 crossd .B \-b
16 cb58f329 2020-01-15 crossd .I bits
17 cb58f329 2020-01-15 crossd ] [
18 cb58f329 2020-01-15 crossd .I "name \&..."
19 cb58f329 2020-01-15 crossd ]
20 cb58f329 2020-01-15 crossd .PP
21 cb58f329 2020-01-15 crossd .B uncompress
22 cb58f329 2020-01-15 crossd [
23 cb58f329 2020-01-15 crossd .B \-f
24 cb58f329 2020-01-15 crossd ] [
25 cb58f329 2020-01-15 crossd .B \-v
26 cb58f329 2020-01-15 crossd ] [
27 cb58f329 2020-01-15 crossd .B \-c
28 cb58f329 2020-01-15 crossd ] [
29 cb58f329 2020-01-15 crossd .B \-V
30 cb58f329 2020-01-15 crossd ] [
31 cb58f329 2020-01-15 crossd .I "name \&..."
32 cb58f329 2020-01-15 crossd ]
33 cb58f329 2020-01-15 crossd .PP
34 cb58f329 2020-01-15 crossd .B zcat
35 cb58f329 2020-01-15 crossd [
36 cb58f329 2020-01-15 crossd .B \-V
37 cb58f329 2020-01-15 crossd ] [
38 cb58f329 2020-01-15 crossd .I "name \&..."
39 cb58f329 2020-01-15 crossd ]
40 cb58f329 2020-01-15 crossd .SH DESCRIPTION
41 cb58f329 2020-01-15 crossd .I Compress
42 cb58f329 2020-01-15 crossd reduces the size of the named files using adaptive Lempel-Ziv coding.
43 cb58f329 2020-01-15 crossd Whenever possible,
44 cb58f329 2020-01-15 crossd each file is replaced by one with the extension
45 cb58f329 2020-01-15 crossd .B "\&.Z,"
46 cb58f329 2020-01-15 crossd while keeping the same ownership modes, access and modification times.
47 cb58f329 2020-01-15 crossd If no files are specified, the standard input is compressed to the
48 cb58f329 2020-01-15 crossd standard output.
49 cb58f329 2020-01-15 crossd Compressed files can be restored to their original form using
50 cb58f329 2020-01-15 crossd .I uncompress
51 cb58f329 2020-01-15 crossd or
52 cb58f329 2020-01-15 crossd .I zcat.
53 cb58f329 2020-01-15 crossd .PP
54 cb58f329 2020-01-15 crossd The
55 cb58f329 2020-01-15 crossd .B \-f
56 cb58f329 2020-01-15 crossd option will force compression of
57 cb58f329 2020-01-15 crossd .I name.
58 cb58f329 2020-01-15 crossd This is useful for compressing an entire directory,
59 cb58f329 2020-01-15 crossd even if some of the files do not actually shrink.
60 cb58f329 2020-01-15 crossd If
61 cb58f329 2020-01-15 crossd .B \-f
62 cb58f329 2020-01-15 crossd is not given and
63 cb58f329 2020-01-15 crossd .I compress
64 cb58f329 2020-01-15 crossd is run in the foreground,
65 cb58f329 2020-01-15 crossd the user is prompted as to whether an existing file should be overwritten.
66 cb58f329 2020-01-15 crossd .PP
67 cb58f329 2020-01-15 crossd The
68 cb58f329 2020-01-15 crossd .B \-c
69 cb58f329 2020-01-15 crossd option makes
70 cb58f329 2020-01-15 crossd .I compress/uncompress
71 cb58f329 2020-01-15 crossd write to the standard output; no files are changed.
72 cb58f329 2020-01-15 crossd The nondestructive behavior of
73 cb58f329 2020-01-15 crossd .I zcat
74 cb58f329 2020-01-15 crossd is identical to that of
75 cb58f329 2020-01-15 crossd .I uncompress
76 cb58f329 2020-01-15 crossd .B \-c.
77 cb58f329 2020-01-15 crossd .PP
78 cb58f329 2020-01-15 crossd .I Compress
79 cb58f329 2020-01-15 crossd uses the modified Lempel-Ziv algorithm popularized in
80 cb58f329 2020-01-15 crossd "A Technique for High Performance Data Compression",
81 cb58f329 2020-01-15 crossd Terry A. Welch,
82 cb58f329 2020-01-15 crossd .I "IEEE Computer,"
83 cb58f329 2020-01-15 crossd vol. 17, no. 6 (June 1984), pp. 8-19.
84 cb58f329 2020-01-15 crossd Common substrings in the file are first replaced by 9-bit codes 257 and up.
85 cb58f329 2020-01-15 crossd When code 512 is reached, the algorithm switches to 10-bit codes and
86 cb58f329 2020-01-15 crossd continues to use more bits until the
87 cb58f329 2020-01-15 crossd limit specified by the
88 cb58f329 2020-01-15 crossd .B \-b
89 cb58f329 2020-01-15 crossd flag is reached (default 16).
90 cb58f329 2020-01-15 crossd .I Bits
91 cb58f329 2020-01-15 crossd must be between 9 and 16. The default can be changed in the source to allow
92 cb58f329 2020-01-15 crossd .I compress
93 cb58f329 2020-01-15 crossd to be run on a smaller machine.
94 cb58f329 2020-01-15 crossd .PP
95 cb58f329 2020-01-15 crossd After the
96 cb58f329 2020-01-15 crossd .I bits
97 cb58f329 2020-01-15 crossd limit is attained,
98 cb58f329 2020-01-15 crossd .I compress
99 cb58f329 2020-01-15 crossd periodically checks the compression ratio. If it is increasing,
100 cb58f329 2020-01-15 crossd .I compress
101 cb58f329 2020-01-15 crossd continues to use the existing code dictionary. However,
102 cb58f329 2020-01-15 crossd if the compression ratio decreases,
103 cb58f329 2020-01-15 crossd .I compress
104 cb58f329 2020-01-15 crossd discards the table of substrings and rebuilds it from scratch. This allows
105 cb58f329 2020-01-15 crossd the algorithm to adapt to the next "block" of the file.
106 cb58f329 2020-01-15 crossd .PP
107 cb58f329 2020-01-15 crossd Note that the
108 cb58f329 2020-01-15 crossd .B \-b
109 cb58f329 2020-01-15 crossd flag is omitted for
110 cb58f329 2020-01-15 crossd .I uncompress,
111 cb58f329 2020-01-15 crossd since the
112 cb58f329 2020-01-15 crossd .I bits
113 cb58f329 2020-01-15 crossd parameter specified during compression
114 cb58f329 2020-01-15 crossd is encoded within the output, along with
115 cb58f329 2020-01-15 crossd a magic number to ensure that neither decompression of random data nor
116 cb58f329 2020-01-15 crossd recompression of compressed data is attempted.
117 cb58f329 2020-01-15 crossd .PP
118 cb58f329 2020-01-15 crossd .ne 8
119 cb58f329 2020-01-15 crossd The amount of compression obtained depends on the size of the
120 cb58f329 2020-01-15 crossd input, the number of
121 cb58f329 2020-01-15 crossd .I bits
122 cb58f329 2020-01-15 crossd per code, and the distribution of common substrings.
123 cb58f329 2020-01-15 crossd Typically, text such as source code or English
124 cb58f329 2020-01-15 crossd is reduced by 50\-60%.
125 cb58f329 2020-01-15 crossd Compression is generally much better than that achieved by
126 cb58f329 2020-01-15 crossd Huffman coding (as used in
127 cb58f329 2020-01-15 crossd .IR pack ),
128 cb58f329 2020-01-15 crossd or adaptive Huffman coding
129 cb58f329 2020-01-15 crossd .RI ( compact ),
130 cb58f329 2020-01-15 crossd and takes less time to compute.
131 cb58f329 2020-01-15 crossd .PP
132 cb58f329 2020-01-15 crossd Under the
133 cb58f329 2020-01-15 crossd .B \-v
134 cb58f329 2020-01-15 crossd option,
135 cb58f329 2020-01-15 crossd a message is printed yielding the percentage of
136 cb58f329 2020-01-15 crossd reduction for each file compressed.
137 cb58f329 2020-01-15 crossd .PP
138 cb58f329 2020-01-15 crossd If the
139 cb58f329 2020-01-15 crossd .B \-V
140 cb58f329 2020-01-15 crossd option is specified, the current version and compile options are printed on
141 cb58f329 2020-01-15 crossd stderr.
142 cb58f329 2020-01-15 crossd .PP
143 cb58f329 2020-01-15 crossd Exit status is normally 0;
144 cb58f329 2020-01-15 crossd if the last file is larger after (attempted) compression, the status is 2;
145 cb58f329 2020-01-15 crossd if an error occurs, exit status is 1.
146 cb58f329 2020-01-15 crossd .SH "SEE ALSO"
147 cb58f329 2020-01-15 crossd pack(1), compact(1)
148 cb58f329 2020-01-15 crossd .SH "DIAGNOSTICS"
149 cb58f329 2020-01-15 crossd Usage: compress [\-dfvcV] [\-b maxbits] [file ...]
150 cb58f329 2020-01-15 crossd .in +8
151 cb58f329 2020-01-15 crossd Invalid options were specified on the command line.
152 cb58f329 2020-01-15 crossd .in -8
153 cb58f329 2020-01-15 crossd Missing maxbits
154 cb58f329 2020-01-15 crossd .in +8
155 cb58f329 2020-01-15 crossd Maxbits must follow
156 cb58f329 2020-01-15 crossd .BR \-b \.
157 cb58f329 2020-01-15 crossd .in -8
158 cb58f329 2020-01-15 crossd .IR file :
159 cb58f329 2020-01-15 crossd not in compressed format
160 cb58f329 2020-01-15 crossd .in +8
161 cb58f329 2020-01-15 crossd The file specified to
162 cb58f329 2020-01-15 crossd .I uncompress
163 cb58f329 2020-01-15 crossd has not been compressed.
164 cb58f329 2020-01-15 crossd .in -8
165 cb58f329 2020-01-15 crossd .IR file :
166 cb58f329 2020-01-15 crossd compressed with
167 cb58f329 2020-01-15 crossd .I xx
168 cb58f329 2020-01-15 crossd bits, can only handle
169 cb58f329 2020-01-15 crossd .I yy
170 cb58f329 2020-01-15 crossd bits
171 cb58f329 2020-01-15 crossd .in +8
172 cb58f329 2020-01-15 crossd .I File
173 cb58f329 2020-01-15 crossd was compressed by a program that could deal with
174 cb58f329 2020-01-15 crossd more
175 cb58f329 2020-01-15 crossd .I bits
176 cb58f329 2020-01-15 crossd than the compress code on this machine.
177 cb58f329 2020-01-15 crossd Recompress the file with smaller
178 cb58f329 2020-01-15 crossd .IR bits \.
179 cb58f329 2020-01-15 crossd .in -8
180 cb58f329 2020-01-15 crossd .IR file :
181 cb58f329 2020-01-15 crossd already has .Z suffix -- no change
182 cb58f329 2020-01-15 crossd .in +8
183 cb58f329 2020-01-15 crossd The file is assumed to be already compressed.
184 cb58f329 2020-01-15 crossd Rename the file and try again.
185 cb58f329 2020-01-15 crossd .in -8
186 cb58f329 2020-01-15 crossd .IR file :
187 cb58f329 2020-01-15 crossd filename too long to tack on .Z
188 cb58f329 2020-01-15 crossd .in +8
189 cb58f329 2020-01-15 crossd The file cannot be compressed because its name is longer than
190 cb58f329 2020-01-15 crossd 12 characters.
191 cb58f329 2020-01-15 crossd Rename and try again.
192 cb58f329 2020-01-15 crossd This message does not occur on BSD systems.
193 cb58f329 2020-01-15 crossd .in -8
194 cb58f329 2020-01-15 crossd .I file
195 cb58f329 2020-01-15 crossd already exists; do you wish to overwrite (y or n)?
196 cb58f329 2020-01-15 crossd .in +8
197 cb58f329 2020-01-15 crossd Respond "y" if you want the output file to be replaced; "n" if not.
198 cb58f329 2020-01-15 crossd .in -8
199 cb58f329 2020-01-15 crossd uncompress: corrupt input
200 cb58f329 2020-01-15 crossd .in +8
201 cb58f329 2020-01-15 crossd A SIGSEGV violation was detected which usually means that the input file has
202 cb58f329 2020-01-15 crossd been corrupted.
203 cb58f329 2020-01-15 crossd .in -8
204 cb58f329 2020-01-15 crossd Compression:
205 cb58f329 2020-01-15 crossd .I "xx.xx%"
206 cb58f329 2020-01-15 crossd .in +8
207 cb58f329 2020-01-15 crossd Percentage of the input saved by compression.
208 cb58f329 2020-01-15 crossd (Relevant only for
209 cb58f329 2020-01-15 crossd .BR \-v \.)
210 cb58f329 2020-01-15 crossd .in -8
211 cb58f329 2020-01-15 crossd -- not a regular file: unchanged
212 cb58f329 2020-01-15 crossd .in +8
213 cb58f329 2020-01-15 crossd When the input file is not a regular file,
214 cb58f329 2020-01-15 crossd (e.g. a directory), it is
215 cb58f329 2020-01-15 crossd left unaltered.
216 cb58f329 2020-01-15 crossd .in -8
217 cb58f329 2020-01-15 crossd -- has
218 cb58f329 2020-01-15 crossd .I xx
219 cb58f329 2020-01-15 crossd other links: unchanged
220 cb58f329 2020-01-15 crossd .in +8
221 cb58f329 2020-01-15 crossd The input file has links; it is left unchanged. See
222 cb58f329 2020-01-15 crossd .IR ln "(1)"
223 cb58f329 2020-01-15 crossd for more information.
224 cb58f329 2020-01-15 crossd .in -8
225 cb58f329 2020-01-15 crossd -- file unchanged
226 cb58f329 2020-01-15 crossd .in +8
227 cb58f329 2020-01-15 crossd No savings is achieved by
228 cb58f329 2020-01-15 crossd compression. The input remains virgin.
229 cb58f329 2020-01-15 crossd .in -8
230 cb58f329 2020-01-15 crossd .SH SOURCE
231 cb58f329 2020-01-15 crossd .B \*9/src/cmd/compress/compress.c
232 cb58f329 2020-01-15 crossd .SH "BUGS"
233 cb58f329 2020-01-15 crossd Although compressed files are compatible between machines with large memory,
234 cb58f329 2020-01-15 crossd .BR \-b \12
235 cb58f329 2020-01-15 crossd should be used for file transfer to architectures with
236 cb58f329 2020-01-15 crossd a small process data space (64KB or less, as exhibited by the DEC PDP
237 cb58f329 2020-01-15 crossd series, the Intel 80286, etc.)