pack compresses argument files using a Huffman minimal redundancy code on a byte basis. By default, compressed files have a .z extension appended to the file name, but keep the same owner, permissions, last access time, and last modification time. For example, abc is compressed into abc.z. pack appends the .z to the end of files even if they already have suffixes. For example abc.txt is compressed into abc.txt.z.
Normally pack reports the degree of compression achieved in
each file (the report is printed on the standard output).
This number can be negative for small files with little redundancy
pack refuses to pack a file for the following reasons:
- the file appears to already be packed
- the file name is too long (an error that could occur if .z is appended)
- 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
- there is an error in processing
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, inverting the detailed-report flag at each mention.
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.
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 in2
packs file in1 into out1 and file in2 into out2. The input files are not changed.
MKS Toolkit supports hard links under 2012/8.1/2012R2/10/2016/2019 on NTFS file systems. There is a slight loss of performance for this support. If you do not require hard link support, you should set and export the environment variable TK_NTLINKS_OFF to disable this support.
Possible exit status values are:
An error occurred related to manipulating (opening, closing, renaming) the file, or a single file could not be packed properly (see n).
Indicates that n files could not be packed properly. For example, if three out of six files could not be packed properly, the exit status is 3. Possible reasons for failure include:
- — unknown command line option
- — inability to open a file for reading or writing
- — file is not a regular file
- — file has more than one link
- — file is already packed
- — packed file is not smaller than unpacked one
- — file is too large to pack in place
- — seek on a file failed
- — read or write error occurred
- — truncate operation failed
- — pack could not set the modified time of a packed file
- file: no saving
The file is too small or uniform to benefit from packing. The file can be packed anyway using the
- file: already packed
The file appears to be a packed file. It can be packed nonetheless by specifying the
- file: has links
The file has more than one link. Override with the
- file: directory
pack refuses to modify directories.
- file: empty
The file is empty.
- file: can't pack in place
The file is too large to pack in place. You must specify an output file using the
If you press BREAK while pack is in operation, it does not stop immediately; if it did, it would leave you with a corrupted file. Thus pack just displays this message to show that the BREAK has been received and it stops as soon as it is safe to do so.
Other messages, about inaccessibility of files and so on, are self-explanatory. The exit status is the number of file arguments which could not be processed.
x/OPEN Portability Guide 4.0. UNIX System V. Windows Server 2012. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019.
Any file packed on a Windows system can be unpacked on any supported operating system, and vice-versa.
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
MKS Toolkit Backup and Tape Handling Solutions Guide
PTC MKS Toolkit 10.3 Documentation Build 39.