Previous | Table of Contents | Next |
DESCRIPTION
The external pack command compresses the data stored in a file. It attempts to reduce the size of a file by compressing the data within the file. When a successful compression of data has occurred, the original file name is replaced by the new packed file with a name of name .z. Typical compression reduces the file size by 25 to 40 percent.
The external unpack command unpacks a previously packed file. It reverses the effects of the pack command. It takes a name .z file for input and creates an unpacked name file.
COMMAND FORMAT
Following is the general formats of the pack command.
pack [ - ] [ -f ] [ file_list ] unpack file_list
Options
The following list describes the options that may be used to control how pack functions.
- | Causes pack to toggle the displaying of status information about the compression algorithm on or off. The first occurrence toggles the information on, the number of times a byte is used, its relative frequency, and the code for the byte are displayed. The - option may be placed between names to toggle the information on and off. For example, |
pack - afile - myfile
would display the status information for afile but would not display it for myfile . | |
-f | Forces the compression of the data even if pack realizes there is no saving of space. This may prove useful if you want all files in a directory to be packed so you don t have a mix of different file formats and names. |
Arguments
The following argument may be passed to the pack command.
file_list | The name of the file you wish to pack. Multiple names may be supplied on the command line. Names must not exceed 80 characters. Two additional characters (.z) are placed at the end of each name that is packed. |
The following argument is used by unpack .
file_list | One or more files to be unpacked. The names may be name or name .z. |
FURTHER DISCUSSION
The pack command becomes more efficient the larger the files. Target files for packing are text files with more than three blocks of data. Object and binary files usually do not compress more than 10 percent, whereas text files may compress up to 50 percent.
The pack command may not compress the data in a file for several reasons. The following list explains each reason.
NOTE:
Directories cannot be packed.
The unpack command may fail if any of the following conditions occur.
RELATED COMMANDS
Refer to the pcat command described in Module 102.
RELATED FILES
The pack command displays status messages to the standard output if the - option is toggled on.
The filenames used on the command line that are to be packed must contain 80 characters or less.
The unpack command unpacks files with a filename of name .z. It can accept arguments of name or name .z.
RETURN CODES
The pack command returns an exit status equal to the number of files it failed to pack. The unpack command returns an exit status equal to the number of files it failed to unpack.
APPLICATIONS
You use the pack command to reduce the disk space required to store your commands. Usually, you pack files that are not changed very often.
The unpack command is used only to unpack files previously packed by the pack command. Usually, you only use unpack if you want to make changes to the data stored in the packed file. If you only need to view the contents, you should use the pcat command.
TYPICAL OPERATION
In this activity you use the pack command to compress your copy of the password file. Begin at the shell prompt.
In this activity you use the unpack command to unpack the previously packed passwd file. Begin at the shell prompt.
Previous | Table of Contents | Next |