Introduction
A .Z file, with a capital Z, was made by compress, the
standard Unix compression program of the 1980s and early 1990s. It uses LZW, the same
method as GIF images. Patent claims on LZW led the GNU
project to write gzip as a free replacement, and
gzip, which also compresses better, took over. Old software archives still hold
.tar.Z files, and gzip -d can still unpack them.
Structure
0Magic1F 9D2 bytes2Flags the low 5 bits give the largest code size, 9 to 16; the top bit marks block mode1 byte3LZW codes packed least significant bit firstthe rest
Codes start 9 bits wide and grow by one bit each time the table of strings fills up, up to the largest size in the header. In block mode, which nearly all files use, code 256 clears the table so the compressor can start again when the data changes. There is no checksum and no stored file name or size.