Linux
Extract a tar.xz file on CentOS and RedHat

This guide will show you how to extract a tar.xz file on CentOS or RedHat, and probably other flavors of Linux as well. Traditionally compressed archive files are distributed on Linux systems as tar.gz files which use gzip for compression. Extracting them is as simple as passing xzf to tar.
tar -xvf filename.tar.gz
If you try the same thing using a tar.xz file, you'll find that it doesn't work.
tar -xzf filename.tar.xz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
On newer versions of tar, you can simply replace the z with a J to use the correct (de)compression library, but if you have version 1.15.1 or earlier, you'll find that this doesn't work either. Note that this is a capital "J" and not a lowercase "j" which would be used to specify bzip2 compression.
tar -xJf gnutls.tar.xz
tar: invalid option -- J
Try `tar --help' or `tar --usage' for more information.
Getting around this is as simple as using the xz binary to first decompress the file, and then tar to extract it. If you don't already have it, you can install xz using yum.
yum -y install xz
unxz filename.tar.xz
tar -xf filename.tar
Conversation 7
tar` 1.15.1 or earlier. If you have one of these older version like I do on some of my legacy servers, the easiest thing to do is combine `tar` with `unxz`.yum remove -y xz && yum install -y xz). That should remove/reinstallxzand set the proper file permissions and attributes, but if not make sure that theunxzis in your page (or use the full path to the binary) and double check that it has execute permissions withchmod +x unxz. It could also be that use are using a 32 bit binary on a 64 bit system, or vice versa. Good luck!