compress compresses each input file using Lempel-Ziv compression techniques. If you do not specify any input files, compress reads data from the standard input and writes the compressed result to the standard output.
On systems using a FAT file system, compress writes
compressed output to work files; when the compression finishes
successfully, it removes the original files and gives the names of the
original files to the work files. In effect, the files are compressed
If you want compressed output to go to a different file, use
On other file systems, output files have the same names as the input files
but with a .Z suffix. For example, abc
is compressed into abc.Z. The .Z suffix is
appended regardless of existing suffixes; for example, abc.txt
would be compressed into abc.txt.Z.
If the .Z file already exists and you did not specify the
compress uses the modified Lempel-Ziv algorithm described in
A Technique for High Performance Data Compression,
Terry A. Welch,
IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8-19.
compress first replaces common substrings in the file
by 9-bit codes starting at 257.
After it reaches code 512, compress begins with 10-bit
codes and continues to use more bits until it reaches
the limit set by the
After attaining the bits limit, compress periodically checks the compression ratio. If it is increasing, compress continues to use the existing code dictionary. However, if the compression ratio decreases, compress discards the table of substrings and rebuilds it from scratch. This allows the algorithm to compensate for files, such as archives, where individual components have different information content profiles.
Limits the maximum number of bits of compression to bits. The value bits may be an integer from 9 to 16. The default is 16.
Writes the output to the standard output. When you use this option, you can only specify one file on the command line.
Allows an extra degree of compression to be done for files such as sorted dictionaries where subsequent lines normally have many characters in common with the preceding line.
Decompresses argument files instead of compressing them. This works by overlaying the compress program with the uncompress program. For this to work, uncompress must be available somewhere in your search path (given by the PATH environment variable). Decompressing files this way is slower than calling uncompress directly.
Forces compression even if the resulting file is larger or the output file already exists. When you do not specify this option, files which are larger after compression are not compressed. compress does not print an error message if this happens.
puts the output file in the specified output_directory.
specifies that the input file is not to be removed.
Displays the version number of compress.
Displays statistics giving the amount of compression achieved. Statistics give the name of each file compressed and the compression ratio, expressed as a percentage. If the file resulting from compression is larger than the original, the compression ratio is negative.
Contains a list of directories for compress to search when looking for the uncompress utility.
Possible exit status values are:
Failure because of one of the following errors:
- — missing number of bits after -b option
- — invalid number of bits specified
- — failed to execute uncompress
- — unknown option
- — dictionary option -- same count of string exceeded
- — output path or file name too long
- — cannot stat file
- — argument file not a regular file: unchanged
- — argument file has other links: unchanged
- — no space for compression tables
One or more files were not compressed because the compressed version was larger than the original.
This implementation of compress is limited to a maximum of 16 bit compression.
Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.
A binary-compatible version of compress with more options is often found on UNIX systems.
For portability, you should restrict the number of bits in the code
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
- bzdiff, bzgrep, bzip2, bzmore, cpio, gzip, mkszip, pax, tar, uncompress, unpack, unzip, zcat, zip, zipinfo
MKS Toolkit Backup and Tape Handling Solutions Guide
PTC MKS Toolkit 10.1 Documentation Build 15.