How to extract tar.xz files on CentOS

CentOS-LogoI’ve recently come across a tarsal files that used xz compression (namely the Python source code).

This means that my usual way of extracting a tarsal via the command line using the following command did not work:

That had me stumped! Turns out that files with a tar.gz ending can be extracted this way (because the use gzip compression, specified by the z parameter). If tar is instructed to use this format on a tar.xz file, it fails.

The solution: specify the xz compression, using the capital letter J, like this:

Another Linux mystery solved – thanks to Justin Solver for this tip!

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

Add your voice!