uncompress [ -cfFqv ] [ file | -P fd ]
zcat [file]
zcat- display compressed files
The compress command takes a file and compresses it to a smaller size (without loss of information), creates a compressed output file, and removes the original file unless the -c option is present. Compression is achieved by encoding common strings within the file.
uncompress restores a previously compressed file to its uncompressed state and removes the compressed version.
zcat uncompresses and displays a file on the standard output. If no file is specified, zcat reads from the standard input.
compress deals with input and output files depending on the arguments specified:
Files created by compress have the same permissions and ownership as the corresponding input files, or the user's standard permissions if output is directed through the standard output.
If no space is saved by compression, compress will not write an output file unless the -F flag is present on the command line.
If you attempt to compress a symbolic link, the link will be broken and a compressed copy of the file to which the symbolic link pointed will be created locally. compress will fail on a file with hard (non-symbolic) links.
The -v option is not compatible with the -c option.
compress uses a version of Lempel-Ziv encoding to reduce the redundancy of information stored in files. A variable length sequence of bits is used to represent each character string encountered in the file; in general, the more frequently the string occurs, the less bits are used to represent it. The ratio of the size of the compressed file to the size of the uncompressed original depends on the type of file. Database files tend to shrink dramatically, while short files or some binaries may shrink very little.
Decompression is controlled by a two byte magic number at the start of a compressed file: this is 1F 9D for a standard (Lempel-Ziv-Welch) compressed file, and 1F A0 for a LZH (Lempel-Ziv-Huffman) compressed file. Implementations of compress on other systems may not recognize LZH compressed files.
ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
Portions of this code used for Lempel-Ziv-Huffman encoding were based on Rahul Dhesi's zoo archiver which was adapted from Haruhiko Okumura's ar archiver. The SCO implementation of LZH compression may not be interoperable with other implementations.
SCO OpenServer Release 5.0.6 -- 1 August 2000