teach manpages about largefile's demise
[unleashed.git] / share / man / man1 / compress.1
blob8a34f130e2f16ca609b582492951ba04fe6be633
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved
46 .\"
47 .TH COMPRESS 1 "Mar 13, 2008"
48 .SH NAME
49 compress, uncompress, zcat \- compress, uncompress files or display expanded
50 files
51 .SH SYNOPSIS
52 .LP
53 .nf
54 \fBcompress\fR [\fB-fv/\fR] [\fB-b\fR \fIbits\fR] [\fIfile\fR]...
55 .fi
57 .LP
58 .nf
59 \fBcompress\fR \fB-c\fR [\fB-fv\fR] [\fB-b\fR \fIbits\fR] [\fIfile\fR]
60 .fi
62 .LP
63 .nf
64 \fBuncompress\fR [\fB-fv\fR] [\fB-c | -/\fR] [\fIfile\fR]...
65 .fi
67 .LP
68 .nf
69 \fBzcat\fR [\fIfile\fR]...
70 .fi
72 .SH DESCRIPTION
73 .SS "compress"
74 .sp
75 .LP
76 The \fBcompress\fR utility attempts to reduce the size of the named files by
77 using adaptive Lempel-Ziv coding. Except when the output is to the standard
78 output, each file is replaced by one with the extension \fB\&.Z\fR, while
79 keeping the same ownership modes, change times and modification times, ACLs,
80 and extended attributes. The compress utility also attempt to set the owner and
81 group of \fIfile\fR\fB\&.z\fR to the owner and group of file, but does not fail
82 if this cannot be done. If appending the \fB\&.Z\fR to the file pathname would
83 make the pathname exceed \fB1023\fR bytes, the command fails. If no files are
84 specified, the standard input is compressed to the standard output.
85 .sp
86 .LP
87 The amount of compression obtained depends on the size of the input, the number
88 of \fIbits\fR per code, and the distribution of common substrings. Typically,
89 text such as source code or English is reduced by 50\(mi60%. Compression is
90 generally much better than that achieved by Huffman coding (as used in
91 \fBpack\fR(1)) and it takes less time to compute. The \fIbits\fR parameter
92 specified during compression is encoded within the compressed file, along with
93 a magic number to ensure that neither decompression of random data nor
94 recompression of compressed data is subsequently allowed.
95 .SS "uncompress"
96 .sp
97 .LP
98 The \fBuncompress\fR utility restores files to their original state after they
99 have been compressed using the \fBcompress\fR utility. If no files are
100 specified, the standard input is uncompressed to the standard output.
103 This utility supports the uncompressing of any files produced by
104 \fBcompress\fR. For files produced by \fBcompress\fR on other systems,
105 \fBuncompress\fR supports 9- to 16-bit compression (see \fB-b\fR).
106 .SS "zcat"
109 The \fBzcat\fR utility writes to standard output the uncompressed form of files
110 that have been compressed using \fBcompress\fR. It is the equivalent of
111 \fBuncompress\fR\fB-c\fR. Input files are not affected.
112 .SH OPTIONS
115 The following options are supported:
117 .ne 2
119 \fB\fB-b\fR \fIbits\fR\fR
121 .RS 11n
122 Sets the upper limit (in bits) for common substring codes. \fIbits\fR must be
123 between 9 and 16 (16 is the default). Lowering the number of bits result in
124 larger, less compressed files.
128 .ne 2
130 \fB\fB-c\fR\fR
132 .RS 11n
133 Writes to the standard output; no files are changed and no \fB\&.Z\fR files are
134 created. The behavior of \fBzcat\fR is identical to that of `\fBuncompress\fR
135 \fB-c\fR'.
139 .ne 2
141 \fB\fB-f\fR\fR
143 .RS 11n
144 When compressing, forces compression of \fIfile\fR, even if it does not
145 actually reduce the size of the file, or if the corresponding
146 \fIfile\fR\fB\&.Z\fR file already exists.
148 If the \fB-f\fR option is not specified, and the process is not running in the
149 background, prompts to verify whether an existing file should be overwritten.
150 If the response is affirmative, the existing file is overwritten. When
151 uncompressing, does not prompt for overwriting files. If the \fB-f\fR option is
152 not specified, and the process is not running in the background, prompts to
153 verify whether an existing file should be overwritten. If the standard input is
154 not a terminal and \fB-f\fR is not specified, writes a diagnostic message to
155 standard error and exits with a status greater than \fB0\fR.
159 .ne 2
161 \fB\fB-v\fR\fR
163 .RS 11n
164 Verbose. Writes to standard error messages concerning the percentage reduction
165 or expansion of each file.
169 .ne 2
171 \fB\fB-/\fR\fR
173 .RS 11n
174 When compressing or decompressing, copies any extended system attributes
175 associated with the source file to the target file and copies any extended
176 system attributes associated with extended attributes of the source file to the
177 corresponding extended attributes associated with the target file. If any
178 extended system attributes cannot be copied, the original file is retained, a
179 diagnostic is written to \fBstderr\fR, and the final exit status is
180 \fBnon-zero\fR.
183 .SH OPERANDS
186 The following operand is supported:
188 .ne 2
190 \fB\fIfile\fR\fR
192 .RS 8n
193 A path name of a file to be compressed by \fBcompress\fR, uncompressed by
194 \fBuncompress\fR, or whose uncompressed form is written to standard out by
195 \fBzcat\fR. If \fIfile\fR is \fB\(mi\fR, or if no \fIfile\fR is specified, the
196 standard input is used.
199 .SH ENVIRONMENT VARIABLES
202 See \fBenviron\fR(5) for descriptions of the following environment variables
203 that affect the execution of \fBcompress\fR, \fBuncompress\fR, and \fBzcat\fR:
204 \fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
205 and \fBNLSPATH\fR.
208 Affirmative responses are processed using the extended regular expression
209 defined for the \fByesexpr\fR keyword in the \fBLC_MESSAGES\fR category of the
210 user's locale. The locale specified in the \fBLC_COLLATE\fR category defines
211 the behavior of ranges, equivalence classes, and multi-character collating
212 elements used in the expression defined for \fByesexpr\fR. The locale specified
213 in \fBLC_CTYPE\fR determines the locale for interpretation of sequences of
214 bytes of text data a characters, the behavior of character classes used in the
215 expression defined for the \fByesexpr\fR. See \fBlocale\fR(5).
216 .SH EXIT STATUS
219 The following error values are returned:
221 .ne 2
223 \fB\fB0\fR\fR
225 .RS 6n
226 Successful completion.
230 .ne 2
232 \fB\fB1\fR\fR
234 .RS 6n
235 An error occurred.
239 .ne 2
241 \fB\fB2\fR\fR
243 .RS 6n
244 One or more files were not compressed because they would have increased in size
245 (and the \fB-f\fR option was not specified).
249 .ne 2
251 \fB\fB>2\fR\fR
253 .RS 6n
254 An error occurred.
257 .SH ATTRIBUTES
260 See \fBattributes\fR(5) for descriptions of the following attributes:
265 box;
266 c | c
267 l | l .
268 ATTRIBUTE TYPE  ATTRIBUTE VALUE
270 CSI     Enabled
272 Interface Stability     Committed
274 Standard        See \fBstandards\fR(5).
277 .SH SEE ALSO
280 \fBln\fR(1), \fBpack\fR(1), \fBfgetattr\fR(3C), \fBfsetattr\fR(3C),
281 \fBattributes\fR(5), \fBenviron\fR(5), \fBlocale\fR(5),
282 \fBstandards\fR(5)
283 .SH DIAGNOSTICS
285 .ne 2
287 \fBUsage: \fBcompress [-fv/] [-b\fR \fIbits\fR] [\fIfile\fR\|.\|.\|. ]\fR
291 \fB\fBcompress c [-fv] [-b\fR \fIbits\fR] [\fIfile\fR\|.\|.\|. ]\fR
293 .sp .6
294 .RS 4n
295 Invalid options were specified on the command line.
299 .ne 2
301 \fBUsage: \fBuncompress [-fv] [-c | -/] [\fR\fIfile\fR\fB]...\fR\fR
303 .sp .6
304 .RS 4n
305 Invalid options were specified on the command line.
309 .ne 2
311 \fBMissing maxbits\fR
313 .sp .6
314 .RS 4n
315 Maxbits must follow \fB-b\fR, or invalid maxbits, not a numeric value.
319 .ne 2
321 \fB\fIfile\fR: not in compressed format\fR
323 .sp .6
324 .RS 4n
325 The file specified to \fBuncompress\fR has not been compressed.
329 .ne 2
331 \fB\fIfile\fR: compressed with \fIxx\fRbits, can only handle \fIyy\fRbits\fR
333 .sp .6
334 .RS 4n
335 \fBfile\fR was compressed by a program that could deal with more \fIbits\fR
336 than the compress code on this machine. Recompress the file with smaller
337 \fIbits\fR.
341 .ne 2
343 \fB\fIfile\fR: already has .\|Z suffix -- no change\fR
345 .sp .6
346 .RS 4n
347 The file is assumed to be already compressed. Rename the file and try again.
351 .ne 2
353 \fB\fIfile\fR: already exists; do you wish to overwrite (y or n)?\fR
355 .sp .6
356 .RS 4n
357 Respond \fBy\fR if you want the output file to be replaced; \fBn\fR if not.
361 .ne 2
363 \fBuncompress: corrupt input\fR
365 .sp .6
366 .RS 4n
367 A \fBSIGSEGV\fR violation was detected, which usually means that the input file
368 is corrupted.
372 .ne 2
374 \fBCompression:\fIxx.xx\fR\fB%\fR\fR
376 .sp .6
377 .RS 4n
378 Percentage of the input saved by compression. (Relevant only for \fB-v\fR.)
382 .ne 2
384 \fB- - not a regular file: unchanged\fR
386 .sp .6
387 .RS 4n
388 When the input file is not a regular file, (such as a directory), it is left
389 unaltered.
393 .ne 2
395 \fB- - has \fIxx\fR other links: unchanged\fR
397 .sp .6
398 .RS 4n
399 The input file has links; it is left unchanged. See \fBln\fR(1) for more
400 information.
404 .ne 2
406 \fB- - file unchanged\fR
408 .sp .6
409 .RS 4n
410 No savings are achieved by compression. The input remains uncompressed.
414 .ne 2
416 \fB- -filename too long to tack on .Z\fR
418 .sp .6
419 .RS 4n
420 The path name is too long to append the \fB\&.Z\fR suffix.
424 .ne 2
426 \fB- -cannot preserve extended attributes. file unchanged\fR
428 .sp .6
429 .RS 4n
430 Extended system attributes could not be copied.
433 .SH NOTES
436 Although compressed files are compatible between machines with large memory,
437 \fB-b\fR 12 should be used for file transfer to architectures with a small
438 process data space (64KB or less).
441 \fBcompress\fR should be more flexible about the existence of the \fB\&.\|Z\fR
442 suffix.