compress

Compress ( / usr / bin / compress ) is a compression program under Unixes and Unix-like operating systems. Its function as well as its behavior is defined in the POSIX standard ( and thus also in the Single Unix Specification and the IEEE 1003.1 ). It forms, with its counterpart uncompress (/ usr / bin / uncompress ) the usual method, space-saving to store archives.

Operation

Not files, but breaks with a greater errorlevel 2 from - On systems that do not support the Lempel- Ziv algorithm, modified compress the - passed as an argument. Also to abort with an error message occurs when the file extension. Z would be exceed those established by the kernel constant NAME_MAX maximum name length.

On all other systems, the files are packed and replaced by the packed file whose name is extended by an attached. Z. Presented permission of the executing process from to do so, permissions and ownership are retained. These files can use the uncompress program (/ usr / bin / uncompress ) be unpacked again, with uncompress the attached file extension. Z removed.

As gzip and bzip2 compress only single files. If several files or even entire directories hierarchies are combined, it is typically with an archiving program ( tar, cpio, backup, etc. ) are used together, the output of which can then be compressed.

Patent law considerations

The POSIX standard specifies that compress files after adaptive Lempel- Ziv algorithm (also: LZC, a variant of the LZW algorithm ) edited. This algorithm (more precisely, actually: the underlying algorithm LZ78 ) as well as its extension by Terry A. Welch was protected until 2003 (in Japan until 2004) by U.S. patents that were issued to the Sperry Corporation.

Alternatives

This dependence on a proprietary process was one reason for the development of alternatives such as gzip and bzip2, both. Similar to, but public domain, compression methods are based variable pointers Therefore, the GNU operating system uses gzip ( GNU zip) as a replacement for compress. gzip can read files created with compress and decompress namely, the compression is not supported due to the used for this purpose (former) patented process.

Instructions for use, examples

Usually compress takes one or more file name as an argument and replaces these files directly in the file system by its compressed version. To the switch C, the compressed version is instead issued to stdout and does not change the file system contents. One hand this can be used to store compressed backups on all kinds of external devices ( tape drives, etc.) ( the data stream is then provided a suitable driver program via a pipeline available ), or to bypass the otherwise occurring deletion of the output files:

# Compress -c / path / to / input > / path / to / output.Z Furthermore, the switch -c N offers the possibility to influence the compression ( -srate ): N is the maximum number of bits to be used for a code ( values ​​9-14 are supported). Longer codes allow better compression while at the same time increasing computational effort.

199268
de