COMPRESS(1) — USER COMMANDS
NAME
compress, uncompress, zcat − compress and expand files
SYNOPSIS
compress [ −c ] [ −f ] [ −v ] [ −b bits ] [ filename ... ]
uncompress [ −c ] [ −v ] [ filename ... ]
zcat [ filename ... ]
DESCRIPTION
compress reduces the size of the named files using adaptive Lempel-Ziv coding. Whenever possible, each file is replaced by one with the extension .Z, while keeping the same ownership modes, access and modification times. If no files are specified, the standard input is compressed to the standard output.
The amount of compression obtained depends on the size of the input, the number of bits per code, and the distribution of common substrings. Typically, text such as source code or English is reduced by 50−60%. Compression is generally much better than that achieved by Huffman coding (as used in pack), or adaptive Huffman coding (compact), and takes less time to compute. The bits parameter specified during compression is encoded within the compressed file, along with a magic number to ensure that neither decompression of random data nor recompression of compressed data is subsequently allowed.
Compressed files can be restored to their original form using uncompress.
zcat produces uncompressed output on the standard output, but leaves the compressed .Z file intact.
OPTIONS
−c Write to the standard output; no files are changed. The nondestructive behavior of zcat is identical to that of uncompress −c.
−f Force compression of name, even if it does not actually shrink or the corresponding name.Z file already exists.
Except when run in the background under /bin/sh, if −f is not given and compress is run in the foreground, the user is prompted as to whether an existing name.Z file should be overwritten.
−v Verbose. Display the percentage reduction for each file compressed.
−b bits
Set the upper limit (in bits) for common substring codes. bits must be between 9 and 16 (16 is the default).
DIAGNOSTICS
Exit status is normally 0; if the last file was not compressed because it became larger, the status is 2. If an error occurs, exit status is 1.
Usage: compress [−fvc] [−b maxbits] [file ...]
Invalid options were specified on the command line.
Missing maxbits
Maxbits must follow −b.
file: not in compressed format
The file specified to uncompress has not been compressed.
file: compressed with xx bits, can only handle yy bits
file was compressed by a program that could deal with more bits than the compress code on this machine. Recompress the file with smaller bits.
file: already has .Z suffix -- no change
The file is assumed to be already compressed. Rename the file and try again.
file already exists; do you wish to overwrite (y or n)?
Respond "y" if you want the output file to be replaced; "n" if not.
uncompress: corrupt input
A SIGSEGV violation was detected, which usually means that the input file is corrupted.
Compression: xx.xx%
Percentage of the input saved by compression. (Relevant only for −v.)
-- not a regular file: unchanged
When the input file is not a regular file, (e.g. a directory), it is left unaltered.
-- has xx other links: unchanged
The input file has links; it is left unchanged. See ln(1) for more information.
-- file unchanged
No savings are achieved by compression. The input remains uncompressed.
SEE ALSO
A Technique for High Performance Data Compression , Terry A. Welch, IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8-19.
BUGS
Although compressed files are compatible between machines with large memory, −b12 should be used for file transfer to architectures with a small process data space (64KB or less).
compress should be more flexible about the existence of the .Z suffix.
Sun Release 3.2 — Last change: 17 July 1986