Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ zcat(1) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pack(1)

compress(1)

NAME

compress, uncompress, zcat − compress, uncompress files or display expanded files

SYNOPSIS

compress [ −cfv ] [ −b bits ] [ filename... ]

uncompress [ −cv ] [ filename... ]

zcat [ filename... ]

AVAILABILITY

SUNWesu

DESCRIPTION

compress reduces the size of the named files using adaptive Lempel-Ziv coding.  Whenever possible, each file is replaced by one with a .Z, extension.  The ownership modes, access time  and modification time will stay the same.  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(1)), 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, even if the file does not actually shrink, or the corresponding .Z file already exists.  Except when running in the background (under /usr/bin/sh), if −f is not given, prompt to verify whether an existing .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).  Lowering the number of bits will result in larger, less compressed files. 

FILES

/usr/bin/sh

SEE ALSO

pack(1)

A Technique for High Performance Data Compression, Terry A. Welch, IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8-19.

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] [filename ...]
Invalid options were specified on the command line.

Missing maxbits
Maxbits must follow −b. 

filename: not in compressed format
The file specified to uncompress has not been compressed. 

filename: compressed with xxbits, can only handle yybits
filename was compressed by a program that could deal with more bits than the compress code on this machine.  Recompress the file with smaller bits.

filename: already has .Z suffix -- no change
The file is assumed to be already compressed. Rename the file and try again.

filename: 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, (such as 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.

NOTES

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. 

SunOS 5.2  —  Last change: 14 Sep 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026