1compress(1) User Commands compress(1)
2
3
4
6 compress, uncompress, zcat - compress, uncompress files or display
7 expanded files
8
10 compress [-fv/] [-b bits] [file]...
11
12
13 compress -c [-fv] [-b bits] [file]
14
15
16 uncompress [-fv] [-c | -/] [file]...
17
18
19 zcat [file]...
20
21
23 compress
24 The compress utility attempts to reduce the size of the named files by
25 using adaptive Lempel-Ziv coding. Except when the output is to the
26 standard output, each file is replaced by one with the extension .Z,
27 while keeping the same ownership modes, change times and modification
28 times, ACLs, and extended attributes. The compress utility also attempt
29 to set the owner and group of file.z to the owner and group of file,
30 but does not fail if this cannot be done. If appending the .Z to the
31 file pathname would make the pathname exceed 1023 bytes, the command
32 fails. If no files are specified, the standard input is compressed to
33 the standard output.
34
35
36 The amount of compression obtained depends on the size of the input,
37 the number of bits per code, and the distribution of common substrings.
38 Typically, text such as source code or English is reduced by 50−60%.
39 Compression is generally much better than that achieved by Huffman cod‐
40 ing (as used in pack(1)) and it takes less time to compute. The bits
41 parameter specified during compression is encoded within the compressed
42 file, along with a magic number to ensure that neither decompression of
43 random data nor recompression of compressed data is subsequently
44 allowed.
45
46 uncompress
47 The uncompress utility restores files to their original state after
48 they have been compressed using the compress utility. If no files are
49 specified, the standard input is uncompressed to the standard output.
50
51
52 This utility supports the uncompressing of any files produced by com‐
53 press. For files produced by compress on other systems, uncompress sup‐
54 ports 9- to 16-bit compression (see -b).
55
56 zcat
57 The zcat utility writes to standard output the uncompressed form of
58 files that have been compressed using compress. It is the equivalent of
59 uncompress-c. Input files are not affected.
60
62 The following options are supported:
63
64 -b bits Sets the upper limit (in bits) for common substring codes.
65 bits must be between 9 and 16 (16 is the default). Lowering
66 the number of bits result in larger, less compressed files.
67
68
69 -c Writes to the standard output; no files are changed and no
70 .Z files are created. The behavior of zcat is identical to
71 that of `uncompress -c'.
72
73
74 -f When compressing, forces compression of file, even if it
75 does not actually reduce the size of the file, or if the
76 corresponding file.Z file already exists.
77
78 If the -f option is not specified, and the process is not
79 running in the background, prompts to verify whether an
80 existing file should be overwritten. If the response is
81 affirmative, the existing file is overwritten. When uncom‐
82 pressing, does not prompt for overwriting files. If the -f
83 option is not specified, and the process is not running in
84 the background, prompts to verify whether an existing file
85 should be overwritten. If the standard input is not a termi‐
86 nal and -f is not specified, writes a diagnostic message to
87 standard error and exits with a status greater than 0.
88
89
90 -v Verbose. Writes to standard error messages concerning the
91 percentage reduction or expansion of each file.
92
93
94 -/ When compressing or decompressing, copies any extended sys‐
95 tem attributes associated with the source file to the target
96 file and copies any extended system attributes associated
97 with extended attributes of the source file to the corre‐
98 sponding extended attributes associated with the target
99 file. If any extended system attributes cannot be copied,
100 the original file is retained, a diagnostic is written to
101 stderr, and the final exit status is non-zero.
102
103
105 The following operand is supported:
106
107 file A path name of a file to be compressed by compress, uncom‐
108 pressed by uncompress, or whose uncompressed form is written to
109 standard out by zcat. If file is −, or if no file is specified,
110 the standard input is used.
111
112
114 See largefile(5) for the description of the behavior of compress,
115 uncompress, and zcat when encountering files greater than or equal to 2
116 Gbyte ( 2^31 bytes).
117
119 See environ(5) for descriptions of the following environment variables
120 that affect the execution of compress, uncompress, and zcat: LANG,
121 LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH.
122
123
124 Affirmative responses are processed using the extended regular expres‐
125 sion defined for the yesexpr keyword in the LC_MESSAGES category of the
126 user's locale. The locale specified in the LC_COLLATE category defines
127 the behavior of ranges, equivalence classes, and multi-character col‐
128 lating elements used in the expression defined for yesexpr. The locale
129 specified in LC_CTYPE determines the locale for interpretation of
130 sequences of bytes of text data a characters, the behavior of character
131 classes used in the expression defined for the yesexpr. See locale(5).
132
134 The following error values are returned:
135
136 0 Successful completion.
137
138
139 1 An error occurred.
140
141
142 2 One or more files were not compressed because they would have
143 increased in size (and the -f option was not specified).
144
145
146 >2 An error occurred.
147
148
150 See attributes(5) for descriptions of the following attributes:
151
152
153
154
155 ┌─────────────────────────────┬─────────────────────────────┐
156 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
157 ├─────────────────────────────┼─────────────────────────────┤
158 │Availability │SUNWesu │
159 ├─────────────────────────────┼─────────────────────────────┤
160 │CSI │Enabled │
161 ├─────────────────────────────┼─────────────────────────────┤
162 │Interface Stability │Committed │
163 ├─────────────────────────────┼─────────────────────────────┤
164 │Standard │See standards(5). │
165 └─────────────────────────────┴─────────────────────────────┘
166
168 ln(1), pack(1), fgetattr(3C), fsetattr(3C), attributes(5), environ(5),
169 largefile(5), locale(5), standards(5)
170
172 Usage: compress [-fv/] [-b bits] [file... ]
173 compress c [-fv] [-b bits] [file... ]
174
175 Invalid options were specified on the command line.
176
177
178 Usage: uncompress [-fv] [-c | -/] [file]...
179
180 Invalid options were specified on the command line.
181
182
183 Missing maxbits
184
185 Maxbits must follow -b, or invalid maxbits, not a numeric value.
186
187
188 file: not in compressed format
189
190 The file specified to uncompress has not been compressed.
191
192
193 file: compressed with xxbits, can only handle yybits
194
195 file was compressed by a program that could deal with more bits
196 than the compress code on this machine. Recompress the file with
197 smaller bits.
198
199
200 file: already has .Z suffix -- no change
201
202 The file is assumed to be already compressed. Rename the file and
203 try again.
204
205
206 file: already exists; do you wish to overwrite (y or n)?
207
208 Respond y if you want the output file to be replaced; n if not.
209
210
211 uncompress: corrupt input
212
213 A SIGSEGV violation was detected, which usually means that the
214 input file is corrupted.
215
216
217 Compression:xx.xx%
218
219 Percentage of the input saved by compression. (Relevant only for
220 -v.)
221
222
223 - - not a regular file: unchanged
224
225 When the input file is not a regular file, (such as a directory),
226 it is left unaltered.
227
228
229 - - has xx other links: unchanged
230
231 The input file has links; it is left unchanged. See ln(1) for more
232 information.
233
234
235 - - file unchanged
236
237 No savings are achieved by compression. The input remains uncom‐
238 pressed.
239
240
241 - -filename too long to tack on .Z
242
243 The path name is too long to append the .Z suffix.
244
245
246 - -cannot preserve extended attributes. file unchanged
247
248 Extended system attributes could not be copied.
249
250
252 Although compressed files are compatible between machines with large
253 memory, -b 12 should be used for file transfer to architectures with a
254 small process data space (64KB or less).
255
256
257 compress should be more flexible about the existence of the .Z suffix.
258
259
260
261SunOS 5.11 13 Mar 2008 compress(1)