I have a file compressed in *.txz. After unpacking it I received a *.tar file. Is there any way to unpack it twice with one command? I mean unpack file (*.tar).txz with one command?
For know I'm do it like this:
xz -d file.txz
tar xvf file.tar
But I wonder if there is nicer way.
Best Answer
That's the same as with any compressed archive. You should never have to create an uncompressed copy of the original file.
Some
tar
implementations like recent versions of GNUtar
have builtin options to callxz
by themselves.With GNU
tar
orbsdtar
:Though, if you've got a version that has
-J
, chances are it will detectxz
files automatically, so:will suffice.
If your GNU or BSD
tar
is too old to supportxz
specifically, you may be able to use the--use-compress-program
option:One of the advantages of having
tar
invoke the compressor utility is that it is able to report the failure of it in its exit status.Note: if the
tar.xz
archive has been created withpixz
,pixz
may have added atar
index to it, which allows extracting files individually without having to uncompress the whole archive: