Linux pack command
Note: The pack and unpack utilities are no longer used on modern systems. If you need to work with files compressed with pack, use the gzip utility, which can automatically detect and decompress files that use pack compression.
pack compresses files using a Huffman minimal redundancy code on a byte basis. Each file is compressed in place; the resulting file has a .z extension appended to the file name, but keeps the same owner and permissions. The times of last access and last modification are also preserved.
Normally pack reports the degree of compression achieved in each file, printing the report to standard output. This number can be negative, especially for small files with little redundancy in their contents, if the -f option is used.
pack does not pack files if:
- The file appears to have already been packed.
- The file name is too long (an error will occur if it already has a .z extension).
- The file has links or is a directory
- The packed file would be larger than the existing file (this includes empty files).
- The destination file already exists, or there is an error in processing.
pack [[-][-B] [-f] [-o file] file] ...
|-||Displays more detail on size, overhead and "entropy" (information rate). If this option is used several times on the command line it acts as a toggle.|
|-f||Forces compression when it normally would not occur. Without this option, pack does not compress a file if its size is not reduced by compression, the file is already compressed, or the file has more than one link.|
|-o file||Specifies a different output file so that compressed output is written to file rather than overwriting the original input file. Several input and output files may be specified. For example,
pack -o out1 in1 -o out2 in2packs file in1 into out1 and file in2 into out2. The input files are not changed.
|>0||An error code greater than zero indicates that an error occurred. The number of files that pack was unable to compress are returned as the exit code.|
Packs the file myfile.txt and renames that file to myfile.txt.z. On successful completion, pack will report compression statistics similar to the following:
pack: myfile.txt: -1.8% Compression
cat — Output the contents of a file.
compress — Compress a file or files.
pcat — Print the uncompressed contents of a compressed file.
tar — Create, modify, list the contents of, and extract files from tar archives.
unpack — Expand a compressed file.
zcat — Print the uncompressed contents of compressed files.