If I have a compressed archive (e.g. archive.tar.xz), I can decompress it and get the archived files back with tar xf archive.tar.xz. As far as I understand, this is technically two steps: decompressing archive.tar, and then "splitting" (for want of a better word) archive.tar into the original file(s).

Is there a way to stop after decompressing, leaving archive.tar? In this case I could use xz -d, but I'd prefer to use tar since that doesn't tie me to xz specifically. tar xf seems to have (some) intelligence in determining what decompression to apply, which I'd like to keep.

So far, the best solution I can come up with is to tar xf archive.tar.xz followed by tar cf [...].

  • 2
    ... after reviewing another, similar question, I'm not confident that this is a real option - tar isn't really for decompression.
    – c-x-berger
    Commented Sep 16, 2021 at 22:38

2 Answers 2


As said in the comments, tar is for creating an archive. The additional compression options are a convenience. You can use the specific compression commands directly:

gzip, gunzip for .tar.gz
bzip2, bunzip2 for .tar.bz2
xz, unxz for .tar.xz

tar itself doesn’t provide an option to decompress an archive without extracting its contents in some way: it manipulates archives, not their compression (in isolation).

There are decompression tools which support a variety of archive formats and will allow you to decompress an archive without knowing which specific compression tool was used; for example, with the command-line version of The Unarchiver:

unar -nr filename.tar.whatever

will extract filename.tar.


You must log in to answer this question.

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