PACK, UNPACK, PCAT(1,C) AIX Commands Reference PACK, UNPACK, PCAT(1,C)
-------------------------------------------------------------------------------
pack, unpack, pcat
PURPOSE
Compresses and decompresses files.
SYNTAX
+------+
pack ---|+----+|-- file --|
+| - |+ ^ |
| -f | +------+
+----+
one of
+--------+ +-- file --+
| unpack |---| |---|
| pcat | ^ +- file.z -+ |
+--------+ +--------------+
DESCRIPTION
The pack command stores the specified file in a compressed form. The 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. (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 generally are
not able to save space with files smaller than three blocks. Typically, text
files are reduced 25 to 40 percent.
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:
o The file is already packed.
o The file has links.
o The file is a directory.
o The file cannot be opened.
o No storage blocks are saved by packing.
o A file called file.z already exists.
o The .z file cannot be created.
o An I/O error occurs during processing.
Processed November 8, 1990 PACK, UNPACK, PCAT(1,C) 1
PACK, UNPACK, PCAT(1,C) AIX Commands Reference PACK, UNPACK, PCAT(1,C)
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:
o The file cannot be opened.
o The file is not a packed file.
o A file with the unpacked file name already exists.
o The unpacked file cannot be created.
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.
The pcat command is equivalent to unpack except that after unpacking the
specified files it writes them to standard output.
Note: 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.
FLAGS
The following flags apply only ot pack.
- 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 - (minus) on the command line toggles this function.
-f Forces packing to occur on files for which there is no space savings.
EXAMPLES
1. To compress files:
pack chap1 chap2
This compresses "chap1" and "chap2", replacing them with files named
"chap1".z and "chap2".z. pack displays the percent decrease in size for
each file.
2. To display statistics about the amount of compression done:
pack - chap1 - chap2
Processed November 8, 1990 PACK, UNPACK, PCAT(1,C) 2
PACK, UNPACK, PCAT(1,C) AIX Commands Reference PACK, UNPACK, PCAT(1,C)
This compresses "chap1" and "chap2" and displays statistics about "chap1",
but not about "chap2". The first - (minus) turns on the statistic display,
and the second turns it off.
3. To display compressed files:
pcat chap1.z chap2 | pg
This displays the compressed files "chap1.z" and "chap2".z on the screen in
expanded form, a page at a time (| "pg"). Note that pcat added the .z to
the end of "chap2", even though we did not enter it.
4. To use a compressed file without expanding the copy stored on disk:
pcat chap1.z | grep 'Greece'
This pipes the contents of "chap1.z" in its expanded form to the grep
command. See page sh-2 for a discussion of piping.
5. To expand compressed files:
unpack chap1.z chap2
This expands the compressed files "chap1.z" and "chap2".z, replacing them
with files named "chap1" and "chap2". You can give unpack file names
either with or without the .z suffix.
RELATED INFORMATION
The following command: "cat."
Processed November 8, 1990 PACK, UNPACK, PCAT(1,C) 3