How to extract tar.xz files on CentOS

- by

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:

tar -zxvf Python*

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

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:

tar -Jxvf Python*
[massive list of files goes here]

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



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site witout any pesky ads! More details here.

Add your voice!

This site uses Akismet to reduce spam. Learn how your comment data is processed.