Some software seems to be distributed in a new archive format:

$ file node-v18.7.0-linux-x64.tar.xz
node-v18.7.0-linux-x64.tar.xz: XZ compressed data

How do I extract this, preferably using tar (like I can with gzip or bzip2) ?

  • 2
    “New” is relative ;-). GNU tar has supported xz archives since March 2009. Aug 10, 2022 at 14:38
  • 1
    @StephenKitt Kind of. It's a different question, so not a duplicate I think, but the solution is the same. Like 'what fruit is in a walford salad?' and 'what keeps the doctor away?' are separate question with the same answer 'apple'. Not sure what the policy is here. Aug 10, 2022 at 14:40
  • 1
    @JeffSchaller they're worded differently because they're different questions (see waldorf salad vs doctors example given previously), but I do understand. I'm glad this still exists as it'll help others who needs to extract an .xz even if they get the answer from a different question. Aug 10, 2022 at 16:38
  • 1
    @Bib Please be kind in comments. I had no idea that tar even supported non-gzip non-bzip2 formats - last I checked (which was a decade ago) it didn't, so I imagined using an external command and piping to tar. Aug 10, 2022 at 18:25
  • 1
    @Bib consider that the manual for tar on my Arch is more than 1k lines, man pages are really not easy to understand for those not used to them, and many users won't even know how to search through a man page as / isn't something you'd guess if you didn't know it. So please be a bit more patient, we're here to answer questions, after all, so we can't expect people to already know.
    – terdon
    Aug 10, 2022 at 19:27

1 Answer 1


Answering my own question to help others: tar (at least GNU tar) already handles this compression format, you can either:

  • Use '-J' to tell tar to expect XZ
tar -xJf node-v18.7.0-linux-x64.tar.xz
(file extracts)
  • Just don't specify a format and let tar detect the compression automatically:
tar -xf node-v18.7.0-linux-x64.tar.xz
(file extracts)

Or if you like to watch the progress:

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

Not the answer you're looking for? Browse other questions tagged .