'\" te .\" Copyright 1989 AT&T .\" Copyright (c) 1996, 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 pack 1 "13 Mar 2008" "SunOS 5.11" "User Commands" .SH NAME pack, pcat, unpack \- compress and expand files .SH SYNOPSIS .LP .nf \fBpack\fR [\fB-f/\fR] [\fB-\fR] \fIfile\fR... .fi .LP .nf \fBpcat\fR \fIfile\fR... .fi .LP .nf \fBunpack\fR [\fB-/\fR] \fIfile\fR... .fi .SH DESCRIPTION .SS "pack" .sp .LP The \fBpack\fR command attempts to store the specified files in a compressed form. Wherever possible (and useful), each input file \fBfile\fR is replaced by a packed file \fBfile\fR\fB\&.z\fR with the same access modes, access and modified dates, and owner as those of \fBfile\fR. If \fBpack\fR is successful, \fBfile\fR is removed. .sp .LP The amount of compression obtained depends on the size of the input file and the character frequency distribution. Because a decoding tree forms the first part of each \fB\&.z\fR file, it is usually not worthwhile to pack files smaller than three blocks, unless the character frequency distribution is very skewed, which can occur with printer plots or pictures. .sp .LP Typically, text files are reduced to 60-75% of their original size. Load modules, which use a larger character set and have a more uniform distribution of characters, show little compression, the packed versions being about 90% of the original size. .sp .LP The \fBpack\fR utility returns a value that is the number of files that it failed to compress. If that number exceeds \fB255\fR, \fB255\fR is returned. .sp .LP No packing occurs if: .RS +4 .TP .ie t \(bu .el o the file appears to be already packed .RE .RS +4 .TP .ie t \(bu .el o the file name is too long to add the \fB\&.z\fR suffix .RE .RS +4 .TP .ie t \(bu .el o the file has links .RE .RS +4 .TP .ie t \(bu .el o the file is a directory .RE .RS +4 .TP .ie t \(bu .el o the file cannot be opened .RE .RS +4 .TP .ie t \(bu .el o the file is empty .RE .RS +4 .TP .ie t \(bu .el o no disk storage blocks are saved by packing .RE .RS +4 .TP .ie t \(bu .el o a file called \fBfile\fR\fB\&.z\fR already exists .RE .RS +4 .TP .ie t \(bu .el o the \fB\&.z\fR file cannot be created .RE .RS +4 .TP .ie t \(bu .el o an I/O error occurred during processing. .RE .sp .LP The last segment of the file name must be short enough to allow space for the appended \fB\&.z\fRextension. Directories cannot be compressed. .SS "pcat" .sp .LP The \fBpcat\fR command does for packed files what \fBcat\fR(1) does for ordinary files, except that \fBpcat\fR cannot be used as a filter. The specified files are unpacked and written to the standard output. .sp .LP \fBpcat\fR returns the number of files it was unable to unpack. Failure can occur if: .RS +4 .TP .ie t \(bu .el o the file cannot be opened; .RE .RS +4 .TP .ie t \(bu .el o the file does not appear to be the output of \fBpack\fR. .RE .SS "unpack" .sp .LP The \fBunpack\fR command expands files created by \fBpack\fR. For each \fBfile\fR specified in the command, a search is made for a file called \fBfile\fR\fB\&.z\fR (or just \fBfile\fR, if \fBfile\fR ends in \fB\&.z\fR). If this file appears to be a packed file, it is replaced by its expanded version. The new file has the \fB\&.z\fR suffix stripped from its name, and has the same access modes, access and modification dates, and owner as those of the packed file. .sp .LP \fBunpack\fR returns a value that is the number of files it was unable to unpack. Failure can occur for the same reasons that it can in \fBpcat\fR, as well as for the following: .RS +4 .TP .ie t \(bu .el o a file with the unpacked name already exists; .RE .RS +4 .TP .ie t \(bu .el o the unpacked file cannot be created. .RE .SH OPTIONS .sp .LP The following options are supported by \fBpack\fR: .sp .ne 2 .mk .na \fB\fB-f\fR\fR .ad .RS 6n .rt Forces packing of \fBfile\fR. This is useful for causing an entire directory to be packed even if some of the files do not benefit. Packed files can be restored to their original form using \fBunpack\fR or \fBpcat\fR. .RE .sp .LP The following options are supported by \fBpack\fR and \fBunpack\fR: .sp .ne 2 .mk .na \fB\fB-/\fR\fR .ad .RS 6n .rt When packing or unpacking, copies any ACL and extended system attributes associated with the source file to the target file. If an ACL or extended system attributes cannot be copied, the original file is retained, a diagnostic message is written to \fBstderr\fR, and the final exit status is \fBnon-zero\fR. .RE .SH OPERANDS .sp .LP The following operands are supported: .sp .ne 2 .mk .na \fB\fBfile\fR\fR .ad .RS 8n .rt A path name of a file to be packed, unpacked, or pcated; \fBfile\fR can include or omit the \fB\&.z\fR suffix. .RE .sp .ne 2 .mk .na \fB\fB\(mi\fR\fR .ad .RS 8n .rt \fBpack\fR uses Huffman (minimum redundancy) codes on a byte-by-byte basis. If the \fB\(mi\fR argument is used, an internal flag is set that causes the number of times each byte is used, its relative frequency, and the code for the byte to be printed on the standard output. Additional occurrences of \fB\(mi\fR in place of \fBfile\fR causes the internal flag to be set and reset. .RE .SH USAGE .sp .LP See \fBlargefile\fR(5) for the description of the behavior of \fBpack\fR, \fBpcat\fR, and \fBunpack\fR when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). .SH EXAMPLES .LP \fBExample 1 \fRViewing a Packed File .sp .LP To view a packed file named \fBfile.z\fR use: .sp .LP \fBexample%\fR \fBpcat\fR \fBfile.z\fR .sp .LP or just: .sp .LP \fBexample%\fR \fBpcat\fR \fBfile\fR .LP \fBExample 2 \fRMaking and Unpacked Copy: .sp .LP To make an unpacked copy, say \fBnnn\fR, of a packed file named \fBfile.z\fR (without destroying \fBfile.z\fR) use the command: .sp .LP \fBexample%\fR \fBpcat\fR \fBfile\fR \fB>nnn\fR .SH ENVIRONMENT VARIABLES .sp .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBpack\fR, \fBpcat\fR, and \fBunpack\fR: \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. .SH EXIT STATUS .sp .LP The following exit 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\fB>0\fR\fR .ad .RS 6n .rt An error occurred. The number of files the command failed to pack/unpack is returned. If the number of failures exceeds \fB255\fR, then \fB255\fR is returned. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; lw(2.75i) |lw(2.75i) lw(2.75i) |lw(2.75i) . \fBATTRIBUTE TYPE\fR\fBATTRIBUTE VALUE\fR _ CSIEnabled .TE .SH SEE ALSO .sp .LP \fBcat\fR(1), \fBcompress\fR(1), \fBzcat\fR(1), \fBfgetattr\fR(3C), \fBfsetattr\fR(3C)\fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5)