ncompress: The .Z Package on Modern Linux
ncompress is the Linux package that ships the compress and uncompress binaries for the legacy .Z (LZW) format, absent from most default runner images.
When a pipeline hits an old .Z artifact and reports command not found, ncompress is the package you install. It is a thin wrapper around the same LZW tools, so this page is about getting them present.
What it does
The ncompress package provides compress and uncompress (and sometimes zcat for .Z) implementing the LZW algorithm behind the .Z extension. Installing it makes the compress/uncompress commands available; the flags are the same as classic compress.
Common usage
apt-get install -y ncompress # Debian/Ubuntu
apk add ncompress # Alpine
uncompress vendor.tar.Z # now available
# fallback with no install:
gunzip -c vendor.tar.Z | tar -xOptions
| Item | What it does |
|---|---|
| apt-get install ncompress | Provides compress/uncompress on Debian/Ubuntu |
| apk add ncompress | Provides them on Alpine |
| compress -d / uncompress | Decompress a .Z file |
| gunzip -c / zcat | Read .Z with no ncompress install |
In CI
Prefer the fallback where you only need to read .Z: gunzip and zcat decode LZW without any extra package. Install ncompress only when a tool specifically shells out to compress or uncompress by name, or when you must write .Z.
Common errors in CI
"compress: command not found" is precisely what ncompress fixes. On Alpine, if apk add ncompress reports the package is missing, enable the community repository. If you only need decompression, avoid the install entirely with gunzip -c file.Z.