pack, pcat, unpack - compress and expand files
pack [ - ] [ -f ] filename...
This command is available with the System V software installation
option. Refer to for information on how to install optional software.
pack attempts to store the specified files in a packed form using Huff-
man (minimum redundancy) codes on a byte-by-byte basis. Wherever pos-
sible (and useful), each input file filename is replaced by a packed
file filename.z with the same access modes, access and modified dates,
and owner as those of filename. If pack is successful, filename will
Packed files can be restored to their original form using unpack or
The amount of compression obtained depends on the size of the input
file and the frequency distribution of its characters.
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 distribution of characters is very skewed. This may occur with
printer plots or pictures.
Typically, large 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. Their
packed versions come in at about 90% of the original size.
No packing will occur if:
the file appears to be already packed
the file name has more than 12 characters
the file has links
the file is a directory
the file cannot be opened
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
The last segment of the filename must contain no more than 12 charac-
ters to allow space for the appended .z extension. Directories cannot
pcat does for packed files what cat(1V) does for ordinary files, except
that pcat cannot be used as a filter. The specified files are unpacked
and written to the standard output. To view a packed file named name.z
To make an unpacked copy without destroying the packed version, use
pcat filename>> newname
Failure may occur if:
the filename (exclusive of the .z) has more than 12 characters;
the file cannot be opened;
the file does not appear to be the output of pack.
unpack expands files created by pack. For each file filename specified
in the command, a search is made for a file called filename.z (or just
filename, if filename ends in .z). If this file appears to be a
packed, 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. Failure
may occur for the same reasons that it may in pcat, as well as for the
o a file with the "unpacked" name already exists
o the unpacked file cannot be created.
- Print compression statistics for the following filename or names
on the standard output. Subsequent `-'s between filenames tog-
gle statistics off and on.
-f Force packing of filename. This is useful for causing an entire
directory to be packed, even if some of the files will not bene-
pack returns the number of files that it failed to compress.
pcat returns the number of files it was unable to unpack.
unpack returns the number of files it was unable to unpack.
17 September 1989 PACK(1V)