2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" 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
6 .\" http://www.opengroup.org/bookstore/.
7 .\" 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.
8 .\" This notice shall appear on any product containing this material.
9 .\" 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.
10 .\" 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.
11 .\" 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]
12 .TH COMPRESS 1 "Mar 13, 2008"
14 compress, uncompress, zcat \- compress, uncompress files or display expanded
19 \fBcompress\fR [\fB-fv/\fR] [\fB-b\fR \fIbits\fR] [\fIfile\fR]...
24 \fBcompress\fR \fB-c\fR [\fB-fv\fR] [\fB-b\fR \fIbits\fR] [\fIfile\fR]
29 \fBuncompress\fR [\fB-fv\fR] [\fB-c | -/\fR] [\fIfile\fR]...
34 \fBzcat\fR [\fIfile\fR]...
41 The \fBcompress\fR utility attempts to reduce the size of the named files by
42 using adaptive Lempel-Ziv coding. Except when the output is to the standard
43 output, each file is replaced by one with the extension \fB\&.Z\fR, while
44 keeping the same ownership modes, change times and modification times, ACLs,
45 and extended attributes. The compress utility also attempt to set the owner and
46 group of \fIfile\fR\fB\&.z\fR to the owner and group of file, but does not fail
47 if this cannot be done. If appending the \fB\&.Z\fR to the file pathname would
48 make the pathname exceed \fB1023\fR bytes, the command fails. If no files are
49 specified, the standard input is compressed to the standard output.
52 The amount of compression obtained depends on the size of the input, the number
53 of \fIbits\fR per code, and the distribution of common substrings. Typically,
54 text such as source code or English is reduced by 50\(mi60%. Compression is
55 generally much better than that achieved by Huffman coding (as used in
56 \fBpack\fR(1)) and it takes less time to compute. The \fIbits\fR parameter
57 specified during compression is encoded within the compressed file, along with
58 a magic number to ensure that neither decompression of random data nor
59 recompression of compressed data is subsequently allowed.
63 The \fBuncompress\fR utility restores files to their original state after they
64 have been compressed using the \fBcompress\fR utility. If no files are
65 specified, the standard input is uncompressed to the standard output.
68 This utility supports the uncompressing of any files produced by
69 \fBcompress\fR. For files produced by \fBcompress\fR on other systems,
70 \fBuncompress\fR supports 9- to 16-bit compression (see \fB-b\fR).
74 The \fBzcat\fR utility writes to standard output the uncompressed form of files
75 that have been compressed using \fBcompress\fR. It is the equivalent of
76 \fBuncompress\fR\fB-c\fR. Input files are not affected.
80 The following options are supported:
84 \fB\fB-b\fR \fIbits\fR\fR
87 Sets the upper limit (in bits) for common substring codes. \fIbits\fR must be
88 between 9 and 16 (16 is the default). Lowering the number of bits result in
89 larger, less compressed files.
98 Writes to the standard output; no files are changed and no \fB\&.Z\fR files are
99 created. The behavior of \fBzcat\fR is identical to that of `\fBuncompress\fR
109 When compressing, forces compression of \fIfile\fR, even if it does not
110 actually reduce the size of the file, or if the corresponding
111 \fIfile\fR\fB\&.Z\fR file already exists.
113 If the \fB-f\fR option is not specified, and the process is not running in the
114 background, prompts to verify whether an existing file should be overwritten.
115 If the response is affirmative, the existing file is overwritten. When
116 uncompressing, does not prompt for overwriting files. If the \fB-f\fR option is
117 not specified, and the process is not running in the background, prompts to
118 verify whether an existing file should be overwritten. If the standard input is
119 not a terminal and \fB-f\fR is not specified, writes a diagnostic message to
120 standard error and exits with a status greater than \fB0\fR.
129 Verbose. Writes to standard error messages concerning the percentage reduction
130 or expansion of each file.
139 When compressing or decompressing, copies any extended system attributes
140 associated with the source file to the target file and copies any extended
141 system attributes associated with extended attributes of the source file to the
142 corresponding extended attributes associated with the target file. If any
143 extended system attributes cannot be copied, the original file is retained, a
144 diagnostic is written to \fBstderr\fR, and the final exit status is
151 The following operand is supported:
158 A path name of a file to be compressed by \fBcompress\fR, uncompressed by
159 \fBuncompress\fR, or whose uncompressed form is written to standard out by
160 \fBzcat\fR. If \fIfile\fR is \fB\(mi\fR, or if no \fIfile\fR is specified, the
161 standard input is used.
167 See \fBlargefile\fR(5) for the description of the behavior of \fBcompress\fR,
168 \fBuncompress\fR, and \fBzcat\fR when encountering files greater than or equal
169 to 2 Gbyte ( 2^31 bytes).
170 .SH ENVIRONMENT VARIABLES
173 See \fBenviron\fR(5) for descriptions of the following environment variables
174 that affect the execution of \fBcompress\fR, \fBuncompress\fR, and \fBzcat\fR:
175 \fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
179 Affirmative responses are processed using the extended regular expression
180 defined for the \fByesexpr\fR keyword in the \fBLC_MESSAGES\fR category of the
181 user's locale. The locale specified in the \fBLC_COLLATE\fR category defines
182 the behavior of ranges, equivalence classes, and multi-character collating
183 elements used in the expression defined for \fByesexpr\fR. The locale specified
184 in \fBLC_CTYPE\fR determines the locale for interpretation of sequences of
185 bytes of text data a characters, the behavior of character classes used in the
186 expression defined for the \fByesexpr\fR. See \fBlocale\fR(5).
190 The following error values are returned:
197 Successful completion.
215 One or more files were not compressed because they would have increased in size
216 (and the \fB-f\fR option was not specified).
231 See \fBattributes\fR(5) for descriptions of the following attributes:
239 ATTRIBUTE TYPE ATTRIBUTE VALUE
243 Interface Stability Committed
245 Standard See \fBstandards\fR(5).
251 \fBln\fR(1), \fBpack\fR(1), \fBfgetattr\fR(3C), \fBfsetattr\fR(3C),
252 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBlocale\fR(5),
258 \fBUsage: \fBcompress [-fv/] [-b\fR \fIbits\fR] [\fIfile\fR\|.\|.\|. ]\fR
262 \fB\fBcompress c [-fv] [-b\fR \fIbits\fR] [\fIfile\fR\|.\|.\|. ]\fR
266 Invalid options were specified on the command line.
272 \fBUsage: \fBuncompress [-fv] [-c | -/] [\fR\fIfile\fR\fB]...\fR\fR
276 Invalid options were specified on the command line.
282 \fBMissing maxbits\fR
286 Maxbits must follow \fB-b\fR, or invalid maxbits, not a numeric value.
292 \fB\fIfile\fR: not in compressed format\fR
296 The file specified to \fBuncompress\fR has not been compressed.
302 \fB\fIfile\fR: compressed with \fIxx\fRbits, can only handle \fIyy\fRbits\fR
306 \fBfile\fR was compressed by a program that could deal with more \fIbits\fR
307 than the compress code on this machine. Recompress the file with smaller
314 \fB\fIfile\fR: already has .\|Z suffix -- no change\fR
318 The file is assumed to be already compressed. Rename the file and try again.
324 \fB\fIfile\fR: already exists; do you wish to overwrite (y or n)?\fR
328 Respond \fBy\fR if you want the output file to be replaced; \fBn\fR if not.
334 \fBuncompress: corrupt input\fR
338 A \fBSIGSEGV\fR violation was detected, which usually means that the input file
345 \fBCompression:\fIxx.xx\fR\fB%\fR\fR
349 Percentage of the input saved by compression. (Relevant only for \fB-v\fR.)
355 \fB- - not a regular file: unchanged\fR
359 When the input file is not a regular file, (such as a directory), it is left
366 \fB- - has \fIxx\fR other links: unchanged\fR
370 The input file has links; it is left unchanged. See \fBln\fR(1) for more
377 \fB- - file unchanged\fR
381 No savings are achieved by compression. The input remains uncompressed.
387 \fB- -filename too long to tack on .Z\fR
391 The path name is too long to append the \fB\&.Z\fR suffix.
397 \fB- -cannot preserve extended attributes. file unchanged\fR
401 Extended system attributes could not be copied.
407 Although compressed files are compatible between machines with large memory,
408 \fB-b\fR 12 should be used for file transfer to architectures with a small
409 process data space (64KB or less).
412 \fBcompress\fR should be more flexible about the existence of the \fB\&.\|Z\fR