Extracting or Uncompressing tar.xz Files in Linux

By | 2014/01/07

tar.xz compression is becoming more popular. Here is how it works!

1. On Debian or Ubuntu, first install the package xz-utils
$ sudo apt-get install xz-utils

2. Extract a .tar.xz the same way you would extract any tar.__ file.
$ tar -xf file.tar.xz


1. To create a .tar.xz archive, use tack c
$ tar -cJf linux-3.12.6.tar.xz linux-3.12.6/

That’s $ tar -cJf [name of archive] [directory to compress]

Think x to extract, and c to create.
Rock on,

5 thoughts on “Extracting or Uncompressing tar.xz Files in Linux

  1. pticon

    In order to get rid of all those command line options, I personally use a bash wrapper:
    function extract()
    local archive=”$1″

    [ -n “$archive” ] || return

    if [ -f $archive ] ; then
    case $archive in
    tar xjf $archive ;;

    tar xzf $archive ;;

    bunzip2 $archive ;;

    rar x $archive ;;

    gunzip $archive ;;

    tar xf $archive ;;

    unzip $archive ;;

    uncompress $archive ;;

    tar xfJ $archive ;;

    echo “‘$archive’ cannot be extracted via extract()” ;;
    echo “‘$archive’ is not a valid file”

  2. unknown

    Thanks for the instructions! This helped me a lot!


Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.