summaryrefslogtreecommitdiff
path: root/usr/src/man/man1/compress.1
blob: 57046e4136139218dc5ed0f249c488438bcac358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
'\" te
.\" Copyright 1989 AT&T 
.\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at 
.\" http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
.\"  This notice shall appear on any product containing this material.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH compress 1 "13 Mar 2008" "SunOS 5.11" "User Commands"
.SH NAME
compress, uncompress, zcat \- compress, uncompress files or display expanded
files
.SH SYNOPSIS
.LP
.nf
\fBcompress\fR [\fB-fv/\fR] [\fB-b\fR \fIbits\fR] [\fIfile\fR]...
.fi

.LP
.nf
\fBcompress\fR \fB-c\fR [\fB-fv\fR] [\fB-b\fR \fIbits\fR] [\fIfile\fR]
.fi

.LP
.nf
\fBuncompress\fR [\fB-fv\fR] [\fB-c | -/\fR] [\fIfile\fR]...
.fi

.LP
.nf
\fBzcat\fR [\fIfile\fR]...
.fi

.SH DESCRIPTION
.SS "compress"
.sp
.LP
The \fBcompress\fR utility attempts to reduce the size of the named files by
using adaptive Lempel-Ziv coding. Except when the output is to the standard
output, each file is replaced by one with the extension \fB\&.Z\fR, while
keeping the same ownership modes, change times and modification times, ACLs,
and extended attributes. The compress utility also attempt to set the owner and
group of \fIfile\fR\fB\&.z\fR to the owner and group of file, but does not fail
if this cannot be done. If appending the \fB\&.Z\fR to the file pathname would
make the pathname exceed \fB1023\fR bytes, the command fails. If no files are
specified, the standard input is compressed to the standard output.
.sp
.LP
The amount of compression obtained depends on the size of the input, the number
of \fIbits\fR per code, and the distribution of common substrings. Typically,
text such as source code or English is reduced by 50\(mi60%. Compression is
generally much better than that achieved by Huffman coding (as used in
\fBpack\fR(1)) and it takes less time to compute. The \fIbits\fR parameter
specified during compression is encoded within the compressed file, along with
a magic number to ensure that neither decompression of random data nor
recompression of compressed data is subsequently allowed.
.SS "uncompress"
.sp
.LP
The \fBuncompress\fR utility restores files to their original state after they
have been compressed using the \fBcompress\fR utility. If no files are
specified, the standard input is uncompressed to the standard output.
.sp
.LP
This utility supports the uncompressing of any files produced by
\fBcompress\fR. For files produced by \fBcompress\fR on other systems,
\fBuncompress\fR supports 9- to 16-bit compression (see \fB-b\fR).
.SS "zcat"
.sp
.LP
The \fBzcat\fR utility writes to standard output the uncompressed form of files
that have been compressed using \fBcompress\fR. It is the equivalent of
\fBuncompress\fR\fB-c\fR. Input files are not affected.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-b\fR \fIbits\fR\fR
.ad
.RS 11n
.rt  
Sets the upper limit (in bits) for common substring codes. \fIbits\fR must be
between 9 and 16 (16 is the default). Lowering the number of bits result in
larger, less compressed files.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-c\fR\fR
.ad
.RS 11n
.rt  
Writes to the standard output; no files are changed and no \fB\&.Z\fR files are
created. The behavior of \fBzcat\fR is identical to that of `\fBuncompress\fR
\fB-c\fR'.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-f\fR\fR
.ad
.RS 11n
.rt  
When compressing, forces compression of \fIfile\fR, even if it does not
actually reduce the size of the file, or if the corresponding
\fIfile\fR\fB\&.Z\fR file already exists.
.sp
If the \fB-f\fR option is not specified, and the process is not running in the
background, prompts to verify whether an existing file should be overwritten.
If the response is affirmative, the existing file is overwritten. When
uncompressing, does not prompt for overwriting files. If the \fB-f\fR option is
not specified, and the process is not running in the background, prompts to
verify whether an existing file should be overwritten. If the standard input is
not a terminal and \fB-f\fR is not specified, writes a diagnostic message to
standard error and exits with a status greater than \fB0\fR.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.RS 11n
.rt  
Verbose. Writes to standard error messages concerning the percentage reduction
or expansion of each file.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-/\fR\fR
.ad
.RS 11n
.rt  
When compressing or decompressing, copies any extended system attributes
associated with the source file to the target file and copies any extended
system attributes associated with extended attributes of the source file to the
corresponding extended attributes associated with the target file. If any
extended system attributes cannot be copied, the original file is retained, a
diagnostic is written to \fBstderr\fR, and the final exit status is
\fBnon-zero\fR.
.RE

.SH OPERANDS
.sp
.LP
The following operand is supported:
.sp
.ne 2
.mk
.na
\fB\fIfile\fR\fR
.ad
.RS 8n
.rt  
A path name of a file to be compressed by \fBcompress\fR, uncompressed by
\fBuncompress\fR, or whose uncompressed form is written to standard out by
\fBzcat\fR. If \fIfile\fR is \fB\(mi\fR, or if no \fIfile\fR is specified, the
standard input is used.
.RE

.SH USAGE
.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBcompress\fR,
\fBuncompress\fR, and \fBzcat\fR when encountering files greater than or equal
to 2 Gbyte ( 2^31 bytes).
.SH ENVIRONMENT VARIABLES
.sp
.LP
See \fBenviron\fR(5) for descriptions of the following environment variables
that affect the execution of \fBcompress\fR, \fBuncompress\fR, and \fBzcat\fR:
\fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
and \fBNLSPATH\fR.
.sp
.LP
Affirmative responses are processed using the extended regular expression
defined for the \fByesexpr\fR keyword in the \fBLC_MESSAGES\fR category of the
user's locale. The locale specified in the \fBLC_COLLATE\fR category defines
the behavior of ranges, equivalence classes, and multi-character collating
elements used in the expression defined for \fByesexpr\fR. The locale specified
in \fBLC_CTYPE\fR determines the locale for interpretation of sequences of
bytes of text data a characters, the behavior of character classes used in the
expression defined for the \fByesexpr\fR. See \fBlocale\fR(5).
.SH EXIT STATUS
.sp
.LP
The following error values are returned:
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt  
Successful completion.
.RE

.sp
.ne 2
.mk
.na
\fB\fB1\fR\fR
.ad
.RS 6n
.rt  
An error occurred.
.RE

.sp
.ne 2
.mk
.na
\fB\fB2\fR\fR
.ad
.RS 6n
.rt  
One or more files were not compressed because they would have increased in size
(and the \fB-f\fR option was not specified).
.RE

.sp
.ne 2
.mk
.na
\fB\fB>2\fR\fR
.ad
.RS 6n
.rt  
An error occurred.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
CSIEnabled
_
Interface StabilityCommitted
_
StandardSee \fBstandards\fR(5).
.TE

.SH SEE ALSO
.sp
.LP
\fBln\fR(1), \fBpack\fR(1), \fBfgetattr\fR(3C), \fBfsetattr\fR(3C),
\fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBlocale\fR(5),
\fBstandards\fR(5)
.SH DIAGNOSTICS
.sp
.ne 2
.mk
.na
\fBUsage: \fBcompress [-fv/] [-b\fR \fIbits\fR] [\fIfile\fR\|.\|.\|. ]\fR
.ad
.br
.na
\fB\fBcompress c [-fv] [-b\fR \fIbits\fR] [\fIfile\fR\|.\|.\|. ]\fR
.ad
.sp .6
.RS 4n
Invalid options were specified on the command line.
.RE

.sp
.ne 2
.mk
.na
\fBUsage: \fBuncompress [-fv] [-c | -/] [\fR\fIfile\fR\fB]...\fR\fR
.ad
.sp .6
.RS 4n
Invalid options were specified on the command line.
.RE

.sp
.ne 2
.mk
.na
\fBMissing maxbits\fR
.ad
.sp .6
.RS 4n
Maxbits must follow \fB-b\fR, or invalid maxbits, not a numeric value.
.RE

.sp
.ne 2
.mk
.na
\fB\fIfile\fR: not in compressed format\fR
.ad
.sp .6
.RS 4n
The file specified to \fBuncompress\fR has not been compressed.
.RE

.sp
.ne 2
.mk
.na
\fB\fIfile\fR: compressed with \fIxx\fRbits, can only handle \fIyy\fRbits\fR
.ad
.sp .6
.RS 4n
\fBfile\fR was compressed by a program that could deal with more \fIbits\fR
than the compress code on this machine. Recompress the file with smaller
\fIbits\fR.
.RE

.sp
.ne 2
.mk
.na
\fB\fIfile\fR: already has .\|Z suffix -- no change\fR
.ad
.sp .6
.RS 4n
The file is assumed to be already compressed. Rename the file and try again.
.RE

.sp
.ne 2
.mk
.na
\fB\fIfile\fR: already exists; do you wish to overwrite (y or n)?\fR
.ad
.sp .6
.RS 4n
Respond \fBy\fR if you want the output file to be replaced; \fBn\fR if not.
.RE

.sp
.ne 2
.mk
.na
\fBuncompress: corrupt input\fR
.ad
.sp .6
.RS 4n
A \fBSIGSEGV\fR violation was detected, which usually means that the input file
is corrupted.
.RE

.sp
.ne 2
.mk
.na
\fBCompression:\fIxx.xx\fR\fB%\fR\fR
.ad
.sp .6
.RS 4n
Percentage of the input saved by compression. (Relevant only for \fB-v\fR.)
.RE

.sp
.ne 2
.mk
.na
\fB- - not a regular file: unchanged\fR
.ad
.sp .6
.RS 4n
When the input file is not a regular file, (such as a directory), it is left
unaltered.
.RE

.sp
.ne 2
.mk
.na
\fB- - has \fIxx\fR other links: unchanged\fR
.ad
.sp .6
.RS 4n
The input file has links; it is left unchanged. See \fBln\fR(1) for more
information.
.RE

.sp
.ne 2
.mk
.na
\fB- - file unchanged\fR
.ad
.sp .6
.RS 4n
No savings are achieved by compression. The input remains uncompressed.
.RE

.sp
.ne 2
.mk
.na
\fB- -filename too long to tack on .Z\fR
.ad
.sp .6
.RS 4n
The path name is too long to append the \fB\&.Z\fR suffix.
.RE

.sp
.ne 2
.mk
.na
\fB- -cannot preserve extended attributes. file unchanged\fR
.ad
.sp .6
.RS 4n
Extended system attributes could not be copied.
.RE

.SH NOTES
.sp
.LP
Although compressed files are compatible between machines with large memory,
\fB-b\fR 12 should be used for file transfer to architectures with a small
process data space (64KB or less).
.sp
.LP
\fBcompress\fR should be more flexible about the existence of the \fB\&.\|Z\fR
suffix.