pack
Compress files using Huffman encoding
SYNOPSIS
pack [-f] [file...]
PARAMETERS
-f
Force packing. Allows packing even if the file won't shrink or already ends in .z. Also used if the user does not have write permissions, pack will attempt to change the permissions.
file...
The file(s) to be compressed. If no files are specified, pack attempts to read a list of filenames from standard input.
DESCRIPTION
The pack command in Linux compresses files using an adaptive Huffman coding algorithm. It aims to reduce file size, particularly for text files, although its compression ratios are generally less impressive than modern compression utilities like gzip or bzip2. The command creates a compressed version of each specified file, appending the .z suffix to the original filename. The original file remains intact unless the -f (force) option is used.
Unpacking is achieved using the unpack command, which reverses the packing process. When packing, the program checks disk usage and returns error if there are too many blocks already in use. It checks to make sure the files are smaller than 127 blocks.
CAVEATS
The pack command is considered largely obsolete due to superior compression algorithms offered by tools like gzip, bzip2, and xz. It is less efficient and may not always achieve significant size reduction.
EXIT STATUS
The pack command exits with a status of 0 if all files were packed successfully. A non-zero exit status indicates an error.
FILE MODIFICATION
The original file's modification time is preserved when packing, although this can vary across implementations.
HISTORY
The pack command has been a part of Unix systems since early versions. It provided a simple compression method before more advanced algorithms became widely available. While once useful, it's largely been superseded by other tools offering better compression ratios.
SEE ALSO
unpack(1)