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!

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Add your voice!