Session and utilities

The xz command

Compresses files with the xz algorithm (.xz), the best compressor of the three classics.

Syntax

xz [-d] [-k] archivo

Most useful options

-dDecompresses
-kKeeps the original
-9Maximum compression

Copy-ready examples

$ printf 'texto\n' > f.txt && xz -k f.txt && lsCompress with xz

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • It compresses very well but is slow; ideal for stored files, not for those changing often.

Related commands

FAQ

Why does xz compress better?

Because it uses a stronger algorithm and looks for repetitions in larger windows.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course