HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

c
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][-b maxbits ][file ...]
uncompress [-f][-v][
-c][-V][file ... ]
zcat [-V][file ... ]
Compress Entire Directory Subtrees
compressdir [ options ][directory ... ]
uncompressdir
[options ][directory ... ]
DESCRIPTION
The following commands compress and uncompress files and directory subtrees as indicated:
compress Reduce the size of the named files using adaptive Lempel-Ziv coding. If reduc-
tion is possible, each file is replaced by a new file of the same name with the
suffix .Z added to indicate that it is a compressed file. Original ownership,
modes, access, and modification times are preserved. If no file is specified, or if
- is specified, standard input is compressed to the standard output.
uncompress Restore the compressed files to original form. Resulting les have the original
filename, ownership, and permissions, and the .Z filename suffix is removed. If
no file is specified, or if - is specified, standard input is uncompressed to the
standard output.
zcat Restore the compressed files to original form and send the result to standard
output. If no file is specified, or if - is specified, standard input is uncompressed
to the standard output.
compressdir Front-end processor. Recursively descend each specified directory subtree and
use
compress to compress each file in directory. Existing files are replaced by
a compressed file having the same name plus the suffix .Z, provided the result-
ing file is smaller than the original. If no directories are specified, compression
is applied to all files starting with the current directory.
options may include any valid
compress command options (they are passed
through to compress). To force compression of all files, even when the result
is larger than the original file, use the -f option.
uncompressdir Opposite of compressdir. Restore compressed files 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 file. compress -d is equivalent to uncompress .
-f Force compression of file. This is useful for compressing an entire directory,
even if some of the files do not actually shrink. If -f is not given and
compress is run in the foreground, the user is prompted as to whether an
existing file should be overwritten.
-z This is the same as the -f option except that it does not force compression
when there is null compression.
-v Print a message describing the percentage of reduction for each file compressed.
-c Force compress and uncompress to write to the standard output; no files
are changed. The nondestructive behavior of zcat is identical to that of
HP-UX 11i Version 1: September 2005 1 Hewlett-Packard Company Section 1109