-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux xz Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to xz on Linux, covering Arch Linux, CachyOS, and other distributions including file compression, decompression, and archive management.
xz compresses files with excellent compression.
Features:
- Best compression: Excellent compression ratio
- Slower: Slower than gzip/bzip2
- .xz format: Creates .xz files
- LZMA algorithm: Uses LZMA2 algorithm
Why it matters:
- Best compression: Smallest files
- Archive format: Common format
- Space saving: Maximum space saved
Basic usage:
# Compress file
xz file.txt
# Creates: file.txt.xz
# Original file is removedPreserve original:
# Keep original file
xz -k file.txt
# -k = keep (keeps original)Set level:
# Compression level (0-9)
xz -9 file.txt
# -9 = maximum compression
# -0 = fastest compressionShow progress:
# Verbose mode
xz -v file.txt
# -v = verbose (shows compression info)Extract:
# Decompress
unxz file.txt.xz
# Or
xz -d file.txt.xz
# Creates: file.txtTest integrity:
# Test archive
xz -t file.txt.xz
# -t = test (checks integrity)Check installation:
# Check xz
which xz
# Install if missing
sudo pacman -S xzThis guide covered xz usage, file compression, and decompression for Arch Linux, CachyOS, and other distributions.
- gzip Guide - gzip compression
- bzip2 Guide - bzip2 compression
- Compression Tools - Compression overview
-
xz Documentation:
man xz
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.