XZ Utils provide a general-purpose data compression library and command-line tools. They use the native .xz format with LZMA2 and also support legacy .lzma files.
Overview
XZ Utils are a complete implementation of the .xz file format, aimed at general-purpose data compression on POSIX systems and ports to several non-POSIX platforms. The package combines a compression library with user-facing command-line programs patterned after common gzip workflows.
The core library liblzma offers an API intentionally similar to zlib so existing applications and scripts can adopt .xz support more easily. The xz tool compresses and decompresses files with command-line syntax modeled on gzip. A smaller xzdec tool handles decompression only, and helper scripts such as xzgrep and xzdiff adapt gzip-style file operations to compressed data.
Compression centers on the LZMA2 filter, with optional filter chains (for example BCJ before LZMA2 for executables) to improve ratios on some file types. Typical text and binary inputs can produce smaller archives than gzip; fast modes are competitive with bzip2 for speed, memory, and ratio. Decompression is faster than bzip2 though somewhat slower than gzip, which suits artifacts decompressed many times such as software packages.
Multithreaded compression is supported; multithreaded decompression is planned for the format but not yet available in the current tools.
Key features
- Native .xz format with LZMA2
- Legacy .lzma format support
- liblzma library with zlib-like API
- xz command-line tool like gzip
- xzdec lightweight decompressor
- xzgrep and xzdiff helper scripts
- Optional multi-filter compression chains
- Multithreaded compression
Use cases
- Compressing files for distribution
- Smaller archives than gzip on typical data
- Embedding compression via liblzma
- Grepping and diffing compressed files
- Decompressing packages many times efficiently