'''compress''' is a shell command for data compression based on the LZW algorithm. '''uncompress''' is a companion shell command that restores files to their original state (both content and metadata) from a file created with .
Although once popular, has fallen out of favor because it uses the patented LZW algorithm. Its use has been replaced by commands such as [[gzip]] and bzip2 that use other algorithms and provide better data compression. Compared to [[gzip]] at its fastest setting, is slightly slower at compression, slightly faster at decompression, and has a significantly lower compression ratio. 1.8 MiB of memory is used to compress the Hutter Prize data, slightly more than at its slowest setting.
and have maintained a presence on [[Unix]] and [[BSD]] systems and have been ported to [[IBM i]].
was standardized in X/Open CAE Specification in 1994,[https://pubs.opengroup.org/onlinepubs/009656399/toc.pdf X/Open CAE Specification Commands and Utilities Issue 4, Version 2] (pdf), 1994, opengroup.org and further in The Open Group Base Specifications, Issue 6 and 7. Linux Standard Base does not require .[https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/command.html Chapter 17. Commands and Utilities] in Linux Standard Base Core Specification 5.0.0, linuxfoundation.org
is often excluded from the default installation of a Linux distribution but can be installed from a separate package.[https://pkgs.org/download/ncompress ncompress], pkgs.org is available for FreeBSD, OpenBSD, MINIX, Solaris and AIX.
is allowed for Point-to-Point Protocol in and for HTTP/1.1 in , though it is rarely used in modern deployments as the better deflate/gzip is available.
Most tar implementations support compression by piping data through when given the -Z command line option.
can decompress .Z files.
The US LZW patent expired in 2003, so it is now in the public domain in the United States. Today, all LZW patents worldwide are expired (see Graphics Interchange Format#Unisys and LZW patent enforcement).
As of POSIX.1-2024 supports the DEFLATE algorithm used in gzip.
Example:
The existence of padding bits is actually a bug, as LZW does not require any alignment. This bug existed for more than 35 years and was in the original UNIX compress, ncompress, gzip and the Windows port. All application/x-compress files were created using this bug.
Some implementations write random bits from uninitialized buffer in paddings. There is no guarantee that the paddings will be zeroes. The decompressor must ignore the values in the paddings for compatibility.
|
|