compress(1)

compress(1)

NAME

compress, uncompress, zcat, compressdir, uncompressdir - compress and expand data

SYNOPSIS

Compress Files

compress [-d] [-f-z] [-z] [-v] [-c] [-V] [-bmaxbits ] [ ®le ... ]

uncompress [-f][-v][-c][-V] [ ®le ... ]

zcat [-V] [ ®le ... ]

c

Compress Entire Directory Subtrees compressdir [ options ] [ directory ... ]

uncompressdir [ options ] [ directory ... ]

DESCRIPTION

The following commands compress and uncompress ®les and directory subtrees as indicated:

compress

Reduce the size of the named ®les using adaptive Lempel-Ziv coding. If reduc-

 

tion is possible, each ®le is replaced by a new ®le of the same name with the

 

suf®x .Z added to indicate that it is a compressed ®le. Original ownership,

 

modes, access, and modi®cation times are preserved. If no ®le is speci®ed, or if

 

- is speci®ed, standard input is compressed to the standard output.

uncompress

Restore the compressed ®les to original form. Resulting ®les have the original

 

®lename, ownership, and permissions, and the .Z ®lename suf®x is removed. If

 

no ®le is speci®ed, or if - is speci®ed, standard input is uncompressed to the

 

standard output.

zcat

Restore the compressed ®les to original form and send the result to standard

 

output. If no ®le is speci®ed, or if - is speci®ed, standard input is uncompressed

 

to the standard output.

compressdir

Front-end processor. Recursively descend each speci®ed directory subtree and

 

use compress to compress each ®le in directory. Existing ®les are replaced by

 

a compressed ®le having the same name plus the suf®x .Z, provided the result-

 

ing ®le is smaller than the original. If no directories are speci®ed, compression

 

is applied to all ®les starting with the current directory.

 

options may include any valid compress command options (they are passed

 

through to compress). To force compression of all ®les, even when the result

 

is larger than the original ®le, use the -foption.

uncompressdir Opposite of compressdir . Restore compressed ®les to their original form. options may include any valid uncompress command options (they are passed through to uncompress).

The amount of compression obtained depends on the size of the input, the maximum number of bits (max- bits) per code, and the distribution of common substrings. Typically, text such as source code or English is reduced by 50-60 percent. 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.

Options

These commands recognize the following options in the combinations shown above in SYNOPSIS:

-d

Decompress ®le. compress -dis equivalent to uncompress.

-f

Force compression of ®le.

This is useful for compressing an entire directory,

 

even if some of the ®les do not actually shrink. If -fis not given and

 

compress is run in the foreground, the user is prompted as to whether an

 

existing ®le should be overwritten.

-z

This is the same as the -foption except that it does not force compression

 

when there is null compression.

-v

Print a message describing the percentage of reduction for each ®le compressed.

-c

Force compress and uncompress to write to the standard output; no ®les

 

are changed. The nondestructive behavior of zcat is identical to that of

HP-UX Release 11i: December 2000

− 1 −

Section 1109