Compress

Short description: Unix shell compression program based on the LZW compression algorithm

compress / uncompressOriginal author(s)| Spencer Thomas

|

Initial release| February 1985; 41 years ago (1985-02)
Operating system| Unix, Unix-like, IBM i
Type| Command
compress .ZFilename extension| `.Z`

|

Internet media type| `application/x-compress`
Developed by| Spencer Thomas
Type of format| data compression

compress is a Unix shell compression program based on the LZW compression algorithm.[1] Compared to gzip's fastest setting, compress is slightly slower at compression, slighty faster at decompression, and has a significantly lower compression ratio.[2] 1.8 MiB of memory is used to compress the Hutter Prize data, slightly more than gzip's slowest setting.[3]

The uncompress utility will restore files to their original state after they have been compressed using the compress utility. If no files are specified, the standard input will be uncompressed to the standard output.

In the upcoming POSIX and Single Unix Specification revision, it is planned that DEFLATE algorithm used in gzip format be supported in those utilities.[4]

## Contents

* 1 Description of program
* 2 History
* 3 Special output format
* 4 Standardization and availability
* 5 See also
* 6 References
* 7 External links

## Description of program

Files compressed by compress are typically given the extension ".Z" (modeled after the earlier pack program which used the extension ".z"). Most tar programs will pipe their data through compress when given the command line option "`-Z`". (The tar program in its own does not compress; it just stores multiple files within one tape archive.)

Files can be returned to their original state using uncompress. The usual action of uncompress is not merely to create an uncompressed copy of the file, but also to restore the timestamp and other attributes of the compressed file.

For files produced by compress on other systems, uncompress supports 9- to 16-bit compression.

## History

The LZW algorithm used in compress was patented by Sperry Research Center in 1983. Terry Welch published an IEEE article on the algorithm in 1984,[5] but failed to note that he had applied for a patent on the algorithm. Spencer Thomas of the University of Utah took this article and implemented compress in 1984, without realizing that a patent was pending on the LZW algorithm. The GIF image format also incorporated LZW compression in this way, and Unisys later claimed royalties on implementations of GIF. Joseph M. Orost led the team and worked with Thomas et al. to create the 'final' (4.0) version of compress and published it as free software to the 'net.sources' USENET group in 1985. U.S. Patent 4,558,302 was granted in 1985, and this is why compress could not be used without paying royalties to Sperry Research, which was eventually merged into Unisys.

compress has fallen out of favor in particular user-groups because it makes use of the LZW algorithm, which was covered by a Unisys patent - because of this, gzip and bzip2 increased in popularity on Linux-based operating systems due to their alternative algorithms, along with better file compression. compress has, however, maintained a presence on Unix and BSD systems and the compress and uncompress commands have also been ported to the IBM i operating system.[6]

The US LZW patent expired in 2003, so it is now in the public domain in the United States. All patents on the LZW worldwide have also expired (see Graphics Interchange Format#Unisys and LZW patent enforcement).

In the up-coming POSIX and Single Unix Specification revision, it is planned that DEFLATE algorithm used in gzip format be supported in those utilities.

## Special output format

Output binary consists of bit groups. Each bit group consists of codes with fixed amount of bits (9-16). Each group (except last) should be aligned by amount of bits multiplied by 8 and right padded with zeroes. Last group should be aligned by 8 and padded with zeroes. You can find more information in ncompress issue.

Example:

You want to output ten 9-bit codes, five 10-bit codes and thirteen 11-bit codes. You now have three groups of bits that you want to output: 90 bits, 50 bits and 143 bits.

* First group should then be 90 bits of data + 54 zero bits of padding in order to be aligned to 72 bits (9 bits × 8).
* Second group should then be 50 bits of data + 30 zero bits of padding in order to be aligned to 80 bits (10 bits × 8).
* Third group should then be 143 bits of data + 1 zero bit of padding in order to be aligned to 8 bits (1 byte only, since this is the last group in the output).

It is actually a bug. LZW doesn't require any alignment. This bug is a part of original UNIX compress, ncompress, gzip and even windows port. It exists more than 35 years. All application/x-compress files were created using this bug. So we have to include it in output specification.

Some compress implementations write random bits from uninitialized buffer as alignment bits. There is no guarantee that alignment bits will be zeroes. So in terms of 100% compatibility decompressor have to just ignore alignment bit values.

## Standardization and availability

compress was standardized in X/Open CAE Specification in 1994,[7] and further in The Open Group Base Specifications, Issue 6 and 7.[8] Linux Standard Base does not requires compress.[9]

compress is often not installed by default in Linux distributions, but can be installed from an additional package.[10] compress is available for FreeBSD, OpenBSD, MINIX, Solaris and AIX.

compress is allowed for Point-to-Point Protocol in RFC 1977 and for HTTP/1.1 in RFC 9110, though it is rarely used in modern deployments as the better deflate/gzip is available.

## See also

* Data compression
* Image compression
* List of Unix commands
* gzip

## References

1. ↑ Frysinger, Mike. "ncompress: a public domain project". http://ncompress.sourceforge.net/. "Compress is a fast, simple LZW file compressor. Compress does not have the highest compression rate, but it is one of the fastest programs to compress data. Compress is the de facto standard in the UNIX community for compressing files."
2. ↑ Gommans, Luc. "compression - What's the difference between gzip and compress?" (in en). https://unix.stackexchange.com/a/412573.
3. ↑ "Large Text Compression Benchmark". http://mattmahoney.net/dc/text.html. "compress 4.3d...."
4. ↑ "0001041: Encourage implementations to include better integrity checksum, compression and decompression utilities if possible.". http://austingroupbugs.net/view.php?id=1041.
5. ↑ Welch, Terry A. (1984). "A technique for high performance data compression". IEEE Computer 17 (6): 8–19. doi:10.1109/MC.1984.1659158. https://www.cs.duke.edu/courses/spring03/cps296.5/papers/welch_1984_technique_for.pdf.
6. ↑ IBM. "IBM System i Version 7.2 Programming Qshell" (in en). https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzahz/rzahzpdf.pdf?view=kc.
7. ↑ X/Open CAE Specification Commands and Utilities Issue 4, Version 2 (pdf), 1994, opengroup.org
8. ↑ `compress` – Commands & Utilities Reference, The Single UNIX Specification, Issue 6 from The Open Group
9. ↑ Chapter 17. Commands and Utilities in Linux Standard Base Core Specification 5.0.0, linuxfoundation.org
10. ↑ ncompress, pkgs.org

## External links

* `compress`: compress data – Commands & Utilities Reference, The Single UNIX Specification, Issue 7 from The Open Group
* `[[[:Template:Man/v8]] compress(Template:Man/v8)]` – Template:Man/v8
* `compress(1)` – FreeBSD General Commands Manual
* `compress(1)` – OpenBSD General Commands Manual
* `compress(1)` – Solaris 10 User Commands Reference Manual
* ncompress \- public domain compress/uncompress implementation for POSIX systems
* compress \- original Unix compress (in a compress'd archive)
* compress \- original Unix compress executable (gzip'd)
* Source Code for compress v4.0 (gzip'd sharchives)
* ZIP File containing a Windows port of the compress utility
* source code to the current version of fcompress.c from compress
* bit groups alignment \- Explanation of bit groups alignment.
* lzws \- New library and CLI, implemented without legacy code.
* ruby-lzws \- Ruby bindings with streaming support.
* compress.com \- official website for file compression.

* v
* t
* e

Data compression software

Archivers with
compression
(comparison)|

| Free software|

* 7-Zip
* Archive Manager
* Ark
* Expander
* FreeArc
* Info-ZIP
* KGB Archiver
* PAQ
* PeaZip
* tar
* XAD (decompression only)
* Xarchiver
* Zipeg
* ZPAQ

|

Freeware|

* Filzip
* LHA
* StuffIt Expander (decompression only)
* The Unarchiver (decompression only)
* TUGZip
* ZipGenius

Commercial|

* ARC
* ALZip
* Archive Utility
* ARJ
* BetterZip
* JAR
* MacBinary
* PKZIP/SecureZIP
* PowerArchiver
* StuffIt
* WinAce
* WinRAR
* WinZip

Non-archiving
compressors|

| Generic|

* bzip2
* compress
* gzip
* lzip
* lzop
* pack
* rzip
* Snappy
* XZ Utils

|

For code|

UPX

Audio
compression
(comparison)|

| Lossy|

* Fraunhofer FDK AAC
* Nero AAC Codec
* Freeware Advanced Audio Coder (FAAC)
* Helix DNA Producer
* l3enc
* LAME
* TooLAME
* libavcodec
* libcelt
* libopus
* libspeex
* Musepack
* libvorbis
* Windows Media Encoder

|

Lossless|

* ALAC
* FLAC
* libavcodec
* Monkey's Audio
* mp4als
* OptimFROG
* Shorten
* TTA (True Audio)
* WavPack

Video
compression
(comparison)|

| Lossy|

| MPEG-4 ASP|

* 3ivx
* DivX
* Nero Digital
* FFmpeg
* HDX4
* Xvid

|

H.264 /
MPEG-4 AVC|

* CoreAVC
* Blu-code
* DivX
* FFmpeg
* Nero Digital
* OpenH264
* QuickTime
* x264

HEVC|

* DivX
* x265

Others|

* CineForm
* Cinepak
* Daala
* DNxHD
* Helix DNA Producer
* Indeo
* libavcodec
* Schrödinger (Dirac)
* SBC
* Sorenson
* VP7
* libtheora
* libvpx
* Windows Media Encoder

Lossless|

* FFV1
* Huffyuv
* Lagarith
* MSU Lossless
* YULS

* See also: compression methods and compression formats

0.00

(0 votes)

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Compress&oldid=755746"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template