---
obj: format
aliases: ["xz"]
mime: "application/xz"
extension: "xz"
rev: 2024-01-30
---

# XZ Compression
XZ is a general-purpose data compression tool that belongs to the family of LZ77-based compressors. It provides high compression ratios and fast decompression, making it suitable for various applications. XZ uses the LZMA2 compression algorithm, which is an improved version of LZMA.

## Usage
Usage: `xz [OPTION]... [FILE]...`

### Options
| Option              | Description                                                                                                      |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `-z, --compress`    | force compression                                                                                                |
| `-d, --decompress`  | force decompression                                                                                              |
| `-t, --test`        | test compressed file integrity                                                                                   |
| `-l, --list`        | list information about .xz files                                                                                 |
| `-k, --keep`        | keep (don't delete) input files                                                                                  |
| `-f, --force`       | force overwrite of output file and (de)compress links                                                            |
| `-c, --stdout`      | write to standard output and don't delete input files                                                            |
| `-0 ... -9`         | compression preset; default is 6; take compressor *and* decompressor memory usage into account before using 7-9! |
| `-e, --extreme`     | try to improve compression ratio by using more CPU time; does not affect decompressor memory requirements        |
| `-T, --threads=NUM` | use at most NUM threads; the default is 1; set to 0 to use as many threads as there are processor cores          |
| `-q, --quiet`       | suppress warnings; specify twice to suppress errors too                                                          |
| `-v, --verbose`     | be verbose; specify twice for even more verbose                                                                  |