Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
xz usually makes the smallest files of the classic tools, but it uses more time and memory. It is used for kernel modules, software packages and long-term archives.
xz FILE makes FILE.xz and removes the original. With tar, use -J (tar -cJf).
Zo schrijf je het
xz [OPTION]... [FILE]...
unxz [OPTION]... [FILE]...
xzcat [OPTION]... [FILE]...Opties 21
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 11
$ als gewone gebruiker# als root (of met sudo)
1Compress a file
xz big.sqlYou get big.sql.xz.
2Decompress
unxz big.sql.xzSame as
xz -d big.sql.xz.3Compress fast with all CPU cores
xz -T0 -k vm-disk.raw-T0uses all cores;-kkeeps the original.4Make a tar.xz archive
tar -cJf logs-2026.tar.xz /var/log/archiveGood for archives you keep for a long time.
5Read without unpacking
xzcat app.log.xz | grep -c ERRORCount errors in a compressed log.
6Show details of a compressed file
xz -l app.log.xzCompressed size, uncompressed size, ratio and check type.
7Best possible compression
xz -9e release-notes.tarVery slow but very small. Good for files you send many times.
8Check a downloaded file
xz -t image.xz && echo OKFinds broken downloads.
9Look at a compressed kernel module
RHEL ships kernel modules as .ko.xz files.
10Unpack a cloud image
xz -dk rhel-10-cloud.raw.xzMany cloud and SD-card images are delivered as .xz.
11Limit memory on a small machine
xz --memlimit=256MiB -d huge.xzxz stops with an error instead of using too much RAM.
Niets past bij dit filter.
Let op
- xz removes the original by default; use
-k. - High levels (-9, -e) need a lot of RAM and time.
Tips om te onthouden
- Size: xz < bzip2 < gzip. Speed: gzip > bzip2 > xz. In tar: z = gzip, j = bzip2, J = xz.