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:

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!





You can leave a comment on my original post.