Debian Codegraph @

upstream/debian-unstable/man1/compress.1

raw
1 .TH COMPRESS 1 2024-05-21 ncompress
2 .SH NAME
3 compress, uncompress.real \- compress and expand data
4 .SH SYNOPSIS
5 .ll +8
6 .B compress
7 [
8 .B \-f
9 ] [
10 .B \-k
11 ] [
12 .B \-v
13 ] [
14 .B \-c
15 ] [
16 .B \-V
17 ] [
18 .B \-r
19 ] [
20 .B \-b
21 .I bits
22 ] [
23 .B \-\-
24 ] [
25 .I "name \&..."
26 ]
27 .ll -8
28 .br
29 .B uncompress.real
30 [
31 .B \-f
32 ] [
33 .B \-k
34 ] [
35 .B \-v
36 ] [
37 .B \-c
38 ] [
39 .B \-V
40 ] [
41 .B \-\-
42 ] [
43 .I "name \&..."
44 ]
45 .SH DESCRIPTION
46 Note that the program that would normally be installed as
47 .I uncompress
48 is installed for Debian as
49 .IR uncompress.real .
50 This has been done to avoid conflicting with the more-commonly-used
51 program with the same name that is part of the gzip package.
52 .PP
53 .I Compress
54 reduces the size of the named files using adaptive Lempel\-Ziv coding.
55 Whenever possible,
56 each file is replaced by one with the extension
57 .B "\&.Z,"
58 while keeping the same ownership modes, access and modification times.
59 If no files are specified, the standard input is compressed to the
60 standard output.
61 .I Compress
62 will only attempt to compress regular files.
63 In particular, it will ignore symbolic links.
64 If a file has multiple hard links,
65 .I compress
66 will refuse to compress it unless the
67 .B \-f
68 flag is given.
69 .PP
70 If
71 .B \-f
72 is not given and
73 .I compress
74 is run in the foreground,
75 the user is prompted as to whether an existing file should be overwritten.
76 .PP
77 Compressed files can be restored to their original form using
78 .IR uncompress.real .
79 .PP
80 .I uncompress.real
81 takes a list of files on its command line and replaces each
82 file whose name ends with
83 .B "\&.Z"
84 and which begins with the correct magic number with an uncompressed
85 file without the
86 .B "\&.Z."
87 The uncompressed file will have the mode, ownership and
88 timestamps of the compressed file.
89 .PP
90 The
91 .B \-k
92 option makes
93 .I compress/uncompress
94 keep the input files instead of automatically removing them.
95 .PP
96 The
97 .B \-c
98 option makes
99 .I compress/uncompress.real
100 write to the standard output; no files are changed.
101 .PP
102 If the
103 .B \-r
104 flag is specified,
105 .I compress
106 will operate recursively.
107 If any of the file names specified on the command line are directories,
108 .I compress
109 will descend into the directory and compress all the files it finds there.
110 When compressing, any files already compressed will be ignored, and when
111 decompressing, any files already decompressed will be ignored.
112 .PP
113 The
114 .B \-V
115 flag tells each of these programs to print its version and patchlevel,
116 along with any preprocessor flags specified during compilation, on
117 stderr before doing any compression or uncompression.
118 .PP
119 .I Compress
120 uses the modified Lempel\-Ziv algorithm popularized in
121 "A Technique for High Performance Data Compression",
122 Terry A.\& Welch,
123 .I "IEEE Computer,"
124 vol.\& 17, no.\& 6 (June 1984), pp.\& 8\(en19.
125 Common substrings in the file are first replaced by 9\-bit codes 257 and up.
126 When code 512 is reached, the algorithm switches to 10\-bit codes and
127 continues to use more bits until the
128 limit specified by the
129 .B \-b
130 flag is reached (default 16).
131 .I Bits
132 must be between 9 and 16. The default can be changed in the source to allow
133 .I compress
134 to be run on a smaller machine.
135 .PP
136 After the
137 .I bits
138 limit is attained,
139 .I compress
140 periodically checks the compression ratio. If it is increasing,
141 .I compress
142 continues to use the existing code dictionary. However,
143 if the compression ratio decreases,
144 .I compress
145 discards the table of substrings and rebuilds it from scratch. This allows
146 the algorithm to adapt to the next "block" of the file.
147 .PP
148 Note that the
149 .B \-b
150 flag is omitted for
151 .IR uncompress.real ,
152 since the
153 .I bits
154 parameter specified during compression
155 is encoded within the output, along with
156 a magic number to ensure that neither decompression of random data nor
157 recompression of compressed data is attempted.
158 .PP
159 .ne 8
160 The amount of compression obtained depends on the size of the
161 input, the number of
162 .I bits
163 per code, and the distribution of common substrings.
164 Typically, text such as source code or English
165 is reduced by 50\(en60%.
166 Compression is generally much better than that achieved by
167 Huffman coding (as used in
168 .IR pack ),
169 or adaptive Huffman coding
170 .RI ( compact ),
171 and takes less time to compute.
172 .PP
173 Under the
174 .B \-v
175 option,
176 a message is printed yielding the percentage of
177 reduction for each file compressed.
178 .PP
179 .B \-\-
180 may be used to halt option parsing and force all remaining arguments to be
181 treated as paths.
182 .SH "DIAGNOSTICS"
183 Exit status is normally 0;
184 if the last file is larger after (attempted) compression, the status is 2;
185 if an error occurs, exit status is 1.
186 .PP
187 Usage: compress [\-dfvcVr] [\-b maxbits] [file ...]
188 .in +8
189 Invalid options were specified on the command line.
190 .in -8
191 Missing maxbits
192 .in +8
193 Maxbits must follow
194 .BR \-b .
195 .in -8
196 .IR file :
197 not in compressed format
198 .in +8
199 The file specified to
200 .I uncompress.real
201 has not been compressed.
202 .in -8
203 .IR file :
204 compressed with
205 .I xx
206 bits, can only handle
207 .I yy
208 bits
209 .in +8
210 .I File
211 was compressed by a program that could deal with
212 more
213 .I bits
214 than the compress code on this machine.
215 Recompress the file with smaller
216 .IR bits .
217 .in -8
218 .IR file :
219 already has .Z suffix \-\- no change
220 .in +8
221 The file is assumed to be already compressed.
222 Rename the file and try again.
223 .in -8
224 .IR file :
225 filename too long to tack on .Z
226 .in +8
227 The file cannot be compressed because its name is longer than
228 12 characters.
229 Rename and try again.
230 This message does not occur on BSD systems.
231 .in -8
232 .I file
233 already exists; do you wish to overwrite (y or n)?
234 .in +8
235 Respond "y" if you want the output file to be replaced; "n" if not.
236 .in -8
237 uncompress.real: corrupt input
238 .in +8
239 A SIGSEGV violation was detected which usually means that the input file has
240 been corrupted.
241 .in -8
242 Compression:
243 .I "xx.xx%"
244 .in +8
245 Percentage of the input saved by compression.
246 (Relevant only for
247 .BR \-v .)
248 .in -8
249 \-\- not a regular file or directory: ignored
250 .in +8
251 When the input file is not a regular file or directory,
252 (e.g.\& a symbolic link, socket, FIFO, device file), it is
253 left unaltered.
254 .in -8
255 \-\- has
256 .I xx
257 other links: unchanged
258 .in +8
259 The input file has links; it is left unchanged. See
260 .IR ln "(1)"
261 for more information.
262 Use the
263 .B \-f
264 flag to force compression of multiply\-linked files.
265 .in -8
266 \-\- file unchanged
267 .in +8
268 No savings is achieved by
269 compression. The input remains virgin.
270 .in -8
271 .SH "BUGS"
272 Although compressed files are compatible between machines with large memory,
273 .BR \-b 12
274 should be used for file transfer to architectures with
275 a small process data space (64\~KiB or less, as exhibited by the DEC PDP
276 series, the Intel 80286, etc.)
277 .SH "SEE ALSO"
278 .BR pack (1),
279 .BR compact (1)