2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 1996, 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 PACK 1 "Mar 13, 2008"
14 pack, pcat, unpack \- compress and expand files
18 \fBpack\fR [\fB-f/\fR] [\fB-\fR] \fIfile\fR...
23 \fBpcat\fR \fIfile\fR...
28 \fBunpack\fR [\fB-/\fR] \fIfile\fR...
35 The \fBpack\fR command attempts to store the specified files in a compressed
36 form. Wherever possible (and useful), each input file \fBfile\fR is replaced by
37 a packed file \fBfile\fR\fB\&.z\fR with the same access modes, access and
38 modified dates, and owner as those of \fBfile\fR. If \fBpack\fR is successful,
39 \fBfile\fR is removed.
42 The amount of compression obtained depends on the size of the input file and
43 the character frequency distribution. Because a decoding tree forms the first
44 part of each \fB\&.z\fR file, it is usually not worthwhile to pack files
45 smaller than three blocks, unless the character frequency distribution is very
46 skewed, which can occur with printer plots or pictures.
49 Typically, text files are reduced to 60-75% of their original size. Load
50 modules, which use a larger character set and have a more uniform distribution
51 of characters, show little compression, the packed versions being about 90% of
55 The \fBpack\fR utility returns a value that is the number of files that it
56 failed to compress. If that number exceeds \fB255\fR, \fB255\fR is returned.
64 the file appears to be already packed
70 the file name is too long to add the \fB\&.z\fR suffix
82 the file is a directory
88 the file cannot be opened
100 no disk storage blocks are saved by packing
106 a file called \fBfile\fR\fB\&.z\fR already exists
112 the \fB\&.z\fR file cannot be created
118 an I/O error occurred during processing.
122 The last segment of the file name must be short enough to allow space for the
123 appended \fB\&.z\fRextension. Directories cannot be compressed.
127 The \fBpcat\fR command does for packed files what \fBcat\fR(1) does for
128 ordinary files, except that \fBpcat\fR cannot be used as a filter. The
129 specified files are unpacked and written to the standard output.
132 \fBpcat\fR returns the number of files it was unable to unpack. Failure can
138 the file cannot be opened;
144 the file does not appear to be the output of \fBpack\fR.
149 The \fBunpack\fR command expands files created by \fBpack\fR. For each
150 \fBfile\fR specified in the command, a search is made for a file called
151 \fBfile\fR\fB\&.z\fR (or just \fBfile\fR, if \fBfile\fR ends in \fB\&.z\fR). If
152 this file appears to be a packed file, it is replaced by its expanded version.
153 The new file has the \fB\&.z\fR suffix stripped from its name, and has the same
154 access modes, access and modification dates, and owner as those of the packed
158 \fBunpack\fR returns a value that is the number of files it was unable to
159 unpack. Failure can occur for the same reasons that it can in \fBpcat\fR, as
160 well as for the following:
165 a file with the unpacked name already exists;
171 the unpacked file cannot be created.
176 The following options are supported by \fBpack\fR:
183 Forces packing of \fBfile\fR. This is useful for causing an entire directory to
184 be packed even if some of the files do not benefit. Packed files can be
185 restored to their original form using \fBunpack\fR or \fBpcat\fR.
190 The following options are supported by \fBpack\fR and \fBunpack\fR:
197 When packing or unpacking, copies any ACL and extended system attributes
198 associated with the source file to the target file. If an ACL or extended
199 system attributes cannot be copied, the original file is retained, a diagnostic
200 message is written to \fBstderr\fR, and the final exit status is
207 The following operands are supported:
214 A path name of a file to be packed, unpacked, or pcated; \fBfile\fR can include
215 or omit the \fB\&.z\fR suffix.
224 \fBpack\fR uses Huffman (minimum redundancy) codes on a byte-by-byte basis. If
225 the \fB\(mi\fR argument is used, an internal flag is set that causes the number
226 of times each byte is used, its relative frequency, and the code for the byte
227 to be printed on the standard output. Additional occurrences of \fB\(mi\fR in
228 place of \fBfile\fR causes the internal flag to be set and reset.
234 See \fBlargefile\fR(5) for the description of the behavior of \fBpack\fR,
235 \fBpcat\fR, and \fBunpack\fR when encountering files greater than or equal to 2
239 \fBExample 1 \fRViewing a Packed File
242 To view a packed file named \fBfile.z\fR use:
246 \fBexample%\fR \fBpcat\fR \fBfile.z\fR
254 \fBexample%\fR \fBpcat\fR \fBfile\fR
257 \fBExample 2 \fRMaking and Unpacked Copy:
260 To make an unpacked copy, say \fBnnn\fR, of a packed file named \fBfile.z\fR
261 (without destroying \fBfile.z\fR) use the command:
265 \fBexample%\fR \fBpcat\fR \fBfile\fR \fB>nnn\fR
267 .SH ENVIRONMENT VARIABLES
270 See \fBenviron\fR(5) for descriptions of the following environment variables
271 that affect the execution of \fBpack\fR, \fBpcat\fR, and \fBunpack\fR:
272 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
276 The following exit values are returned:
283 Successful completion.
292 An error occurred. The number of files the command failed to pack/unpack is
293 returned. If the number of failures exceeds \fB255\fR, then \fB255\fR is
300 See \fBattributes\fR(5) for descriptions of the following attributes:
308 ATTRIBUTE TYPE ATTRIBUTE VALUE
316 \fBcat\fR(1), \fBcompress\fR(1), \fBzcat\fR(1), \fBfgetattr\fR(3C),
317 \fBfsetattr\fR(3C)\fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5)