NAME [Toc] [Back]
pack, pcat, unpack - compress and expand files
SYNOPSIS [Toc] [Back]
pack [-] [-f] name ...
pcat name ...
unpack name ...
DESCRIPTION [Toc] [Back]
pack attempts to store the specified files in a compressed form.
Wherever possible, each input file name is replaced by a packed file
name.z with the same ownership, modes, and access and modification
times. The -f option forces packing of name. This is useful for
causing an entire directory to be packed even if some of the files do
not benefit. If pack is successful, name is removed. Packed files
can be restored to their original form using unpack or pcat.
pack uses Huffman (minimum redundancy) codes on a byte-by-byte basis.
If the - 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 - in place of name cause the internal flag to be set
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 .z file, it is usually not
worthwhile to pack files smaller than three blocks unless the
character frequency distribution is very skewed such as in printer
plots or pictures.
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.
pack returns a value that is the number of files that it failed to
No packing occurs if:
+ The file appears to be already packed.
+ The file name has more than 12 characters and the file system
is configured as a short filename system.
+ The file has links.
+ The file is a directory.
+ The file cannot be opened.
+ The file is empty.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
+ No disk storage blocks will be saved by packing.
+ A file called name.z already exists.
+ The .z file cannot be created.
+ An I/O error occurred during processing.
On short-filename systems, the last segment of the file name must
contain no more than 12 characters to allow space for the appended .z
extension. Directories cannot be compressed.
pcat does for packed files what cat(1) does for ordinary files, except
that pcat cannot be used as a filter. The specified files are
unpacked and written to the standard output. Thus to view a packed
file named name.z use:
To make an unpacked copy (named file) of a packed file named name.z
without destroying name.z) use the command:
pcat name >file
pcat returns the number of files it was unable to unpack. Failure may
+ The file name (exclusive of the .z) has more than 12
+ The file cannot be opened;
+ The file does not appear to have been created by pack.
unpack expands files created by pack. For each file name specified in
the command, a search is made for a file called name.z (or just name
if name ends in .z). If this file appears to be a packed file, it is
replaced by its expanded version. The new file has the .z suffix
stripped from its name, and has the same access modes, access and
modification dates, and owner as those of the packed file.
unpack returns a value that is the number of files it was unable to
unpack. Failure may occur for the reasons given for pcat, as well as
for the following:
+ A file with the ``unpacked'' name already exists;
+ The unpacked file cannot be created.
Access Control Lists (ACLs) [Toc] [Back]
pack retains all entries in a file's access control list when
compressing and expanding it (see acl(5)).
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
DEPENDENCIES [Toc] [Back]
Optional access control list entries of networked files are summarized
(as returned in st_mode by stat(), but not copied to the new file (see
WARNINGS [Toc] [Back]
This command is likely to be withdrawn from X/Open standards.
Applications using this command might not be portable to other
vendors' systems. Instead of pack it is recommended to use compress
utility as it has the following advantages:
+ The algorithm used to create the output files is frequently
more effective in reducing the size of files
+ The compress utility can compress data from its standard
input, not just a named regular file. Thus it is useful in
zcat is recommended instead of pcat and, uncompress is recommended
instead of unpack.
SEE ALSO [Toc] [Back]
cat(1), compact(1), compress(1), acl(5).
STANDARDS CONFORMANCE [Toc] [Back]
pack: SVID2, SVID3, XPG2, XPG3
pcat: SVID2, SVID3, XPG2, XPG3
unpack: SVID2, SVID3, XPG2, XPG3
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003 [ Back ]