pack Command
Purpose
Compresses files.
Syntax
Description
The pack command stores the file that is specified by
the File parameter in a compressed form. The input file is replaced by a packed
file with the same name and the suffix .z
appended. If the invoking process has
appropriate privileges, the packed file maintains the same access modes, access and modification
dates, and owner as the original file. The input file name can contain no more than 253 bytes to
allow space for the added .z
suffix. If the pack command is
successful, the original file is removed. Packed files can be restored to their original form by
using the compress command.
The exit value of the pack command is the number of files that it could not pack. The pack command does not pack under any of the following conditions:
- The file is already packed.
- The input file name has more than 253 bytes.
- The file has links.
- The file is a directory.
- The file cannot be opened.
- No storage blocks are saved by packing.
- A file called File
.z
already exists. - The
.z
file cannot be created. - An I/O error occurred during processing.
Flags
Item | Description |
---|---|
-f | Forces packing of the file specified by the File parameter. This is useful for packing an entire directory, even if some of the files will not benefit. |
Parameters
Item | Description |
---|---|
File | Specifies the file to be packed. |
- |
Displays statistics about the file that is specified by the File
parameter. The statistics are calculated from a Huffman minimum redundancy code tree built on a
byte-by-byte basis. Additional occurrences of the - (minus sign) parameter on the command
line toggles this function for the next specified file. See example 2. |
Exit Status
This command returns the following exit values:
Item | Description |
---|---|
0 |
Specifies that the file was successfully packed. |
>0 |
Specifies that an error occurred. |
Examples
- To compress the files named
chap1
andchap2
and display the revised file names, enter:
The compressed versions are renamedpack chap1 chap2
chap1.z
andchap2.z
. The pack command displays the percent decrease in size for each file compressed. - To display statistics about the amount of compression done, enter:
This compresses the files named
chap1
andchap2
and displays statistics about the file namedchap1
, but not about the file namedchap2
. The first-
(minus sign) parameter turns on the statistic display, and the second-
parameter turns it off.
Files
Item | Description |
---|---|
/usr/bin/pack | Contains the pack command. |