Ubuntu includes GNU tar, which recognizes the format by itself! One command works with any supported compression method, per the manual.

# The same command handles any compression format! Ex:

tar xf archive.tar.xz  # for .tar.xz files
tar xf archive.tar.gz  # for .tar.gz files
tar xf archive.tar     # for .tar files

etc. If tar gives a Cannot exec error, you may need to sudo apt install xz-utils first.

Answer from ramslök on askubuntu.com
🌐
Ask Ubuntu
askubuntu.com › questions › 92328 › how-do-i-uncompress-a-tarball-that-uses-xz
tar - How do I uncompress a tarball that uses .xz? - Ask Ubuntu

Ubuntu includes GNU tar, which recognizes the format by itself! One command works with any supported compression method, per the manual.

# The same command handles any compression format! Ex:

tar xf archive.tar.xz  # for .tar.xz files
tar xf archive.tar.gz  # for .tar.gz files
tar xf archive.tar     # for .tar files

etc. If tar gives a Cannot exec error, you may need to sudo apt install xz-utils first.

Answer from ramslök on askubuntu.com
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › how to extract tar.xz files in linux and unzip all files
How to extract tar.xz files in Linux and unzip all files
February 3, 2024 - This tutorial explains how to unzip or extract tar.xz files and .txz archives using the tar and xz Linux bash/ksh/shell command-line options.
🌐
Stack Exchange
unix.stackexchange.com › questions › 713176 › how-do-i-extract-a-tar-xz-file
compression - How do I extract a .tar.xz file? - Unix & Linux Stack Exchange

Several tar implementations (at least GNU tar¹, star and libarchive's bsdtar) already handle this compression format, you can either:

  • Don't explicitly specify a format and let tar detect the compression automatically (with either gtar², bsdtar or star³):

    tar -xf node-v18.7.0-linux-x64.tar.xz
    

    Or if you like to watch the progress:

    tar -xvf node-v18.7.0-linux-x64.tar.xz
    
  • Use -J/--xz (with GNU tar or libarchive bdstar) or -xz (with star) to tell tar to expect XZ

    tar -xJf node-v18.7.0-linux-x64.tar.xz
    
    gtar -xJf node-v18.7.0-linux-x64.tar.xz
    
    bsdtar -xJf node-v18.7.0-linux-x64.tar.xz
    
    star -x -xz -f node-v18.7.0-linux-x64.tar.xz
    

Without those specific tar implementations or with the standard pax command (tar has been removed from the UNIX standard as there were too many incompatibilities between implementations), decompress the archive with xz⁴ and then unpack the archive via a pipe:

xz -dc node-v18.7.0-linux-x64.tar.xz | tar -xvf -
xz -dc node-v18.7.0-linux-x64.tar.xz | pax -rv

¹ generally called tar on GNU systems, but often gtar or gnutar or gnu-tar on other systems if installed there beside the system's one.

² with GNU tar, that doesn't work if the file is passed on stdin with - as the file name or if the file is no seekable in which case you need to pass the -J option.

³ with star, that doesn't work if the file is not seekable in which case you do need to use the -xz option. tar -xf - still works as long as stdin is seekable.

⁴ beware failures of xz may not always be detected in that case. Most Bourne-like shells now support the pipefail option from ksh93 which can help here; set with set -o pipefail.

Answer from mikemaccana on unix.stackexchange.com
🌐
WinZip
winzip.com › en › learn › tips › extract-files › tar-xz-file
How to Extract a TAR.XZ File: A Guide | WinZip
Usually, cloud storage services such as Dropbox automatically extract them for you when downloading or uploading. Also, the latest Linux distributions come with pre-installed XZ extraction tools. However, if you lack these tools, you'll likely need to extract the Tar.xz file on your own.
🌐
Ask Ubuntu
askubuntu.com › questions › 709109 › how-to-untar-a-tar-xz-file
command line - How to untar a .tar.xz file - Ask Ubuntu

The z flag of GNU tar (which is the version of tar shipped with Ubuntu) is used to speciy that the archive being processed is compressed using gzip, which is usually indicated by the .tar.gz (or, more rarely, .tgz) extension. In GNU tar, it is an error to use the z flag if the archive is not compressed with gzip, as you experience now.

Archives using the .tar.xz extension are compressed with xz, and the corresponding flag in GNU tar is J. Hence, replacing z with J in your command should solve your problem. In addition, you may get a "command not found" error if the xz tools are not installed on your system, which can be remedied by installing the xz-utils package.

Alternatively, you can simply omit the filetype-related flag altogether, and simply use -xvf; in that case tar will attempt to autodetect the compression format by analyzing the file. (You can probably also dispense with the v flag; it just prints a list of the extracted files, which is not usually useful.)

Answer from fkraiem on askubuntu.com
🌐
Linuxize
linuxize.com › post › how-to-extract-unzip-tar-xz-file
How to Extract (Unzip) tar.xz File | Linuxize
March 4, 2020 - If the command-line is not your thing, you can use the GUI File manager. To extract (unzip) a tar.xz file simply right-click the file you want to extract and select “Extract”. Windows users need a tool named 7zip to extract tar.xz files.
🌐
Reddit
reddit.com › r/linux4noobs › trying to figure out how to run/extract/use tar.xz files. but every other thread calls the op stupid. nobara/fedora linux
r/linux4noobs on Reddit: Trying to figure out how to run/extract/use tar.xz files. But every other thread calls the op stupid. Nobara/fedora linux

cd to the directory where the tar.xz file is located the do tar -xf filename.tar.xz where filename is the name of the file. This will decompress it. Then you can go inside and follow the install instructions (such as running install.sh file inside it).

🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Extract tar.xz - Raspberry Pi Forums
Note that it isn't .gz ... There are 10 types of people: those who understand binary and those who don't. ... tar -xvf file.tar.xz Thanks, this worked. What I used for .gz before didn't work and I couldn't find a good answer online.
Find elsewhere
🌐
Super User
superuser.com › questions › 904001 › how-to-install-tar-xz-file-in-ubuntu
linux - how to install .tar.xz file in ubuntu - Super User

This is not good practice unless you know the implications of installing software this way, and trust the source of the file.

Decompress:

tar xf [filename]

This will expand the contents of the file to a folder. Then the commands are, from the folder:

./configure
make
sudo make install

This will compile the VLC source code, and then install it into your system. Because you are installing as root, this is why you must know that the source of the file is trustworthy.

To compile vlc, you need at least the following libraries installed:

  • libdvbpsi (compulsory) ,
  • mpeg2dec (compulsory) ,
  • libdvdcss if you want to be able to read encrypted DVDs ,
  • libdvdplay if you want to have DVD menu navigation ,
  • a52dec if you want to be able to decode the AC3 (i.e. A52) sound format often used in DVDs ,
  • ffmpeg, libmad, faad2 if you want to read MPEG 4 / DivX files ,
  • libogg & libvorbis if you want to read Ogg Vorbis files .

You will probably also need to install the build-essential package to get a compiler and associated commands.

More details here

Answer from Paul on superuser.com
🌐
Stack Overflow
stackoverflow.com › questions › 18855850 › create-a-tar-xz-in-one-command
compression - Create a tar.xz in one command - Stack Overflow

Use the -J compression option for xz. And remember to man tar :)

tar cfJ <archive.tar.xz> <files>

Edit 2015-08-10:

If you're passing the arguments to tar with dashes (ex: tar -cf as opposed to tar cf), then the -f option must come last, since it specifies the filename (thanks to @A-B-B for pointing that out!). In that case, the command looks like:

tar -cJf <archive.tar.xz> <files>
Answer from user2062950 on stackoverflow.com
🌐
TecMint
tecmint.com › home › linux commands › how to list and extract tar.xz file in linux
How to List and Extract [Unzip] tar.xz File in Linux
July 13, 2023 - The following examples show how ... option because a tar.xz archive file is filtered through XZ compression, you need to specify the -J or --xz option as the decompression option as shown....
🌐
Aleksandar Haber
aleksandarhaber.com › how-to-view-and-extract-tar-and-tar-xz-files-on-linux
How to view and extract tar and tar.xz files on Linux – Fusion of Engineering, Control, Coding, Machine Learning, and Science
In this brief Linux command line tutorial for robotics and machine learning engineers, we explain how to view and extract tar files. We only explain the basic usage.
🌐
Quora
quora.com › How-do-you-extract-and-install-a-tar-XZ-file-in-Linux
How do you extract and install a tar XZ file in Linux?
Answer: [code]tar xaf [/code]You don’t actually need the a option for .tar.xz tarballs, but it will come in handy with other tarballs. So, remember that one. It’s always the best go-to ;) (x = extract, f = file name follows, a = try to guess the compression from the file extension) T...
🌐
Stack Overflow
stackoverflow.com › questions › 22505761 › how-to-decompress-a-tar-xz-file
linux - How to decompress a .tar.xz file? - Stack Overflow

From the Ubuntu Site here.

tar -xJf wkhtmltox-linux-i386_0.12.0-03c001d.tar.xz
Answer from omoman on stackoverflow.com
🌐
Quora
quora.com › How-do-I-extract-and-install-a-tar-xz-file-in-Linux-Fedora-25
How do I extract and install a .tar.xz file in Linux Fedora 25?
Answer (1 of 5): 1. On Debian or Ubuntu, first install the package xz-utils [code]$ sudo apt-get install xz-utils [/code] 2. Extract a .tar.xz the same way you would extract any tar.__ file. [code]$ tar -xf file.tar.xz [/code]Done. 1. To create a .tar.xz archive, use tack c [code]$ tar -cJ...
🌐
Reddit
reddit.com › r/steamdeck › how to extract tar.xz files?
r/SteamDeck on Reddit: How to extract tar.xz files?

Should be able to do that with the built-in archive manager: Right-click>Extract>Extract archive here, auto-detect subfolder

🌐
Stack Overflow
stackoverflow.com › questions › 60108289 › how-do-i-read-an-tar-xz-file
r - How do I read an .tar.xz file? - Stack Overflow

Base R includes function untar. On my Ubuntu 19.10 running R 3.6.2, default installation, the following was enough.

fls <- list.files(pattern = "\\.xz")
untar(fls[1], verbose = TRUE)

Note.
In the question, "dataset" is singular but there were several datasets (plural) on that website. To download the files I used

args <- "--verbose rsync://78.46.86.149:873/dnmarchives/grams.tar.xz rsync://78.46.86.149:873/dnmarchives/grams-20150714-20160417.tar.xz ./"
cmd <- "rsync"

od <- getwd()
setwd('~/tmp')

system2(cmd, args)
Answer from Rui Barradas on stackoverflow.com
🌐
Wikipedia
en.wikipedia.org › wiki › Tar_(computing)
tar (computing) - Wikipedia
1 week ago - The tar command was abandoned in ... at least since 1994. None-the-less, many operating systems today include tools for tar files, as well as tools to compress and decompress them, such as xz, gzip, and bzip2....
🌐
nixCraft
cyberciti.biz › nixcraft › howto › bash shell › extract tar.gz file in linux or unix using tar
Extract tar.gz File in Linux or Unix using tar - nixCraft
February 18, 2025 - This page shows how to unpack or extract a tar.gz file (tarball archive) on Linux, macOS, *BSD and Unix-like systems using the tar command.
🌐
Super User
superuser.com › questions › 1735189 › error-extracting-tar-xz-files-in-windows-using-command-line
Error extracting tar.xz files in Windows using command line - Super User

xz is the most modern LZMA2 compression option, which apparently the Windows tar program does not support.

You should use another program that does support it, such as 7-Zip.

If the latest 7-Zip does not support xz, try its fork 7-Zip-zstd which supports more compression methods.

Answer from harrymc on superuser.com