SYNOPSIS
pack
[[
DESCRIPTION
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.
Packed files can be identified by file and uncompressed by unpack (which unpacks the file in place) or pcat (which unpacks to the standard output).
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
if the
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
Options
- -
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.
-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 in2
packs file in1 into out1 and file in2 into out2. The input files are not changed.
ENVIRONMENT VARIABLES
- TK_NTLINKS_OFF
-
MKS Toolkit supports hard links under 10/2016/2019/11/2022/2025 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.
DIAGNOSTICS
Possible exit status values are:
- 0
-
Successful completion.
- 1
-
An error occurred related to manipulating (opening, closing, renaming) the file, or a single file could not be packed properly (see n).
- 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
-f option. - file: already packed
-
The file appears to be a packed file. It can be packed nonetheless by specifying the
-f option. - file: has links
-
The file has more than one link. Override with the
-f option. - 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
-o option. - Interrupt
-
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.
PORTABILITY
x/OPEN Portability Guide 4.0. UNIX System V. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.
The
Any file packed on a Windows system can be unpacked on any supported operating system, and vice-versa.
AVAILABILITY
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
SEE ALSO
MKS Toolkit Backup and Tape Handling Solutions Guide
PTC MKS Toolkit 10.5 Documentation Build 40.