Content-type: text/html
pack, pcat, unpack - Compresses and expands files
pack [-f] [-] file[.z]...
unpack file[.z]...
pcat file[.z]...
Interfaces documented on this reference page conform to industry standards as follows:
pack: XPG4, XPG4-UNIX
pcat: XPG4, XPG4-UNIX
unpack: XPG4, XPG4-UNIX
Refer to the
standards(5)
reference page for more information
about industry standards and associated tags.
Displays statistics about the input files. The statistics are calculated from a Huffman minimum redundancy code tree built on a byte-by-byte basis. Repeating the - (dash) on the command line toggles this function. Forces compaction of input files.
These options are applicable to the pack command only.
A pathname of a file to be compressed or uncompressed.
The pack command stores the specified file in a compressed form. The input file is replaced by a packed file with a name derived from the original file name (file.z), with the same access modes, access and modification dates, and owner as the original file.
Directories cannot be compressed.
If pack cannot create a smaller file, it stops processing and reports that it is unable to save space, unless you specify the -f option. (The -f option forces packing to occur even if the files cannot benefit from packing.) A failure to save space generally happens with small files or files with uniform character distribution.
The amount of space saved 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, you will generally not be able to save space with files smaller than three blocks. Typically, text files are reduced 25 to 40 percent.
Object files, which use a larger character set and have a more uniform distribution of characters, show only a 10 percent reduction when packed.
The exit value of the
pack
command is the number
of files that it could not pack. Packing is not done under any one of the
following conditions:
The file is already packed.
The file has links.
The file is a directory.
The file cannot be opened.
No storage blocks are saved by packing. This is overridden
by the
-f
option.
A file called
file.z
already exists.
The
.z
file cannot be created.
An I/O error occurs during processing.
The file name has more than
NAME_MAX-2
bytes.
The file is empty.
The pcat command reads the specified files, unpacks them, and writes them to standard output.
The exit value of
pcat
is the number of files it
was unable to unpack. A file cannot be unpacked if any one of the following
occurs:
The file cannot be opened.
The file is not a packed file.
[Compaq] The file name (exclusive of the
.z)
has more than 12 bytes and it resides on a System V file system.
The unpack command expands files created by pack. For each file specified, unpack searches for a file called file.z. If this file is a packed file, unpack replaces it by its expanded version. The unpack command names the new file name by removing the .z suffix from file. The new file has the same access modes, access and modification dates, and owner as the original packed file.
The exit value is the number of files the
unpack
command was unable to unpack. A file cannot be unpacked if any one of the
following occurs:
The file cannot be opened.
The file is not a packed file.
A file with the unpacked file name already exists.
The unpacked file cannot be created.
The file name has more than
NAME_MAX-2
bytes.
Both
pcat
and
unpack
operate only on files ending in
.z. As a result, when
you specify a file name that does not end in
.z,
pcat
and
unpack
add the suffix and search the
directory for a file name with that suffix.
[Compaq] The
unpack
command writes a warning
to standard output if the file it is unpacking has links. The new unpacked
file has a different inode than the packed file from which it was created.
However, any other files linked to the packed file's original inode still
exist and are still packed.
[Compaq] If
pack
is used on files residing
on a System V file system, the file names must contain no more than 12 bytes
to allow space for the added
.z
extension.
[Compaq] If you try to use
pack
on a very
small file, you might receive the following message:
pack filename: No saving -- file unchanged
The
pack,
pcat, and
unpack
commands are marked to be withdrawn from the XPG4-UNIX
standard. The
compress,
uncompress,
and
zcat
commands should be used instead.
The following exit values are returned:
Successful completion.
[Compaq] The number of files that could not be packed.
Successful completion.
[Compaq] The number of files that could not be unpacked.
Successful completion.
[Compaq] The number of files that could not be unpacked.
To compress files, enter: pack chap1 chap2
The following environment variables affect the execution of
pack,
pcat, and
unpack:
Provides a default value for the internationalization variables
that are unset or null. If
LANG
is unset or null, the corresponding value from the default locale is used.
If any of the internationalization variables contain an invalid setting, the
utility behaves as if none of the variables had been defined.
If set to a non-empty string value, overrides the values of
all the other internationalization variables.
Determines the locale for the interpretation of sequences
of bytes of text data as characters (for example, single-byte as opposed to
multi-byte characters in arguments).
Determines the locale for the format and contents of diagnostic
messages written to standard error.
Determines the location of message catalogues for the processing
of
LC_MESSAGES.
Commands: cat(1), compress(1), uncompress(1), zcat(1)
Standards: standards(5)