LinuxCommandLibrary

unxz

Decompress XZ compressed files

TLDR

Decompress file
$ unxz [file.xz]
copy
Keep original
$ unxz -k [file.xz]
copy
To stdout
$ unxz -c [file.xz]
copy
Force overwrite
$ unxz -f [file.xz]
copy
Decompress multiple
$ unxz [file1.xz] [file2.xz]
copy

SYNOPSIS

unxz [-k] [-c] [-f] [options] files

DESCRIPTION

unxz decompresses files that were compressed with the XZ format, which uses the LZMA2 algorithm for high compression ratios. It is functionally equivalent to running xz --decompress and is provided as a convenience command within the xz-utils package.
By default, unxz replaces the compressed .xz file with the decompressed output, removing the original. The -k flag preserves the original compressed file, and -c writes decompressed data to standard output for piping to other commands.
XZ is widely used in the Linux ecosystem for distributing source code tarballs, kernel sources, and package archives due to its excellent compression ratio. While decompression is fast, XZ compression is slower and more memory-intensive than alternatives like gzip or zstd.

PARAMETERS

-k

Keep original.
-c
Write to stdout.
-f
Force overwrite.
-v
Verbose mode.
-q
Quiet mode.

CAVEATS

Slow for very large files. Part of xz-utils. Single-threaded by default.

HISTORY

unxz is part of XZ Utils, created by Lasse Collin and first released in 2009 as the successor to LZMA Utils. The XZ format has become the standard compression for Linux kernel sources and many source tarballs.

SEE ALSO

xz(1), gzip(1), bzip2(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard