Decompress .xz archives quickly from the shell with a focused, predictable tool. 22.05.2026 | reading time: 2 min Need to extract a .xz file quickly and predictably from the shell; unxz is a tiny wrapper around xz --decompress that does exactly that and removes the .xz by default, making it ideal for simple decompression steps in scripts and workflows. Decompression in action Try this on a test system to see behavior and output: ``` $ printf 'Hello, unxz\n' > hello.txt $ xz hello.txt $ ls -l hello.txt.xz -rw-r--r-- 1 user user 42 Jun 01 12:00 hello.txt.xz $ unxz hello.txt.xz $ ls -l hello.txt -rw-r--r-- 1 user user 13 Jun 01 12:00 hello.txt ``` This shows that `xz` compressed the file and removed the original, and `unxz` restored the plain file. Power-user knobs Use `unxz -c` to decompress to stdout for pipelines, `unxz -k` to keep the original .xz, `unxz -f` to force overwrite, and `unxz -t` to test integrity; for multi-threaded decompression pass `-T` to xz (for example `unxz -T0` delegates threads), and remember that `tar` understands .xz archives via the -J flag so you can also run `tar -xJf archive.tar.xz` instead of manual steps. When unxz isn't enough For archives, combine with tar or use `tar -xJf`; for different algorithms choose gzip or bzip2 tools; for scripted bulk work prefer `xz` with explicit flags or pipelines such as `unxz -c file.xz | tar -x` to avoid temporary files and control file removal and exits. Next steps Master the small differences: whether you want deletion by default, pipeline-friendly stdout, or explicit keeps will change which flags to use; explore `man xz` for the full option set and practice decompression patterns in scripts to build reliable automation, then consider formal certification to deepen system skills with CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities storage backup scripting