How to uncompress .xz file format in Linux using tar and xz utilities?

Updated on November 14, 2017

While installing some packages on Linux, I had to download a dependent module called core-utilities. Surprisingly the core utilities package was compressed using ‘xz‘ and it had an extension as .xz. I have seen .tar, .zip, .bz, .bz2, .gz, .tar.gz file formats, but today was the first time I downloaded packaged with .xz extension. After googling, I found that : XZ Utils is a free general purpose data compression package that yields high compression ratio. Interestingly, .xz compressed files can be uncompressed using well known ‘tar‘ command.

Linux basics

How to use ‘tar’ command to uncompress .xz compressed files?

tar xvfJ filename.tar.xz

But remember, .xz formats are supported only from tar 1.22 version.

If you have a lower version of tar like me, then either you can update your tar command or download xz utilities. To update the tar command, type as shown below:

yum update tar

Note: In case, if “yum update” didn’t work for you, then you may download “tar” source and compile it. Here’s a tutorial to help you install “tar” from source.

How to use ‘XZ’ utils to un-compress .xz files?

$wget http://tukaani.org/xz/xz-5.0.5.tar.gz
$cd xz-5.0.5
$./configure
$make
$sudo make install

Once the package is installed, run the below command to uncompress .xz file formats.

xz -d filename.tar.xz

Was this article helpful?

Related Articles

Leave a Comment