uncompress - Expand compressed data

Synopsis

uncompress [-cv] [-b bits] [file ...]

Description

The uncompress utility restores the compressed files to their original form, renaming the files by deleting the ".Z" extension.

If renaming file would cause files to be overwritten and the standard input device is a terminal, the user is prompted (on standard error) for confirmation. If prompting is not possible or confirmation is not received, the files are not overwritten.

Options

-b bits
Specify the bits code limit (see below for details).
-c
Uncompressed output is written to the standard output. No files are modified.
-v
Print the percentage of expansion for each file.

Operands

Each file is a pathname of a file to uncompress. If no files are specified, the standard input is uncompressed to the standard output. If either the input and output files are not regular files, the checks for reduction in size and file overwriting are not performed, the input file is not removed, and the attributes of the input file are not retained.

Extended description

The uncompress utility uses a modified Lempel-Ziv algorithm. Common substrings in the file are first replaced by 9-bit codes 257 and up. When code 512 is reached, the algorithm switches to 10-bit codes and continues to use more bits until the limit specified by the -b flag is reached (the default is 16). Bits must be between 9 and 16.

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%.

Exit status

  • 0 on success
  • >0 if an error occurs.