When I have a tar archive of any format, I can use:
tar xf archive.tar.xz
tar xf anotherarchive.tar.gz
as tar discovers the relevant format by itself.
Now I want to download the archives and extract them without them being saved on the file system using wget
:
wget -qO- http://someserver.org/sometar.tar.xz | tar xf -C ~/extractTarget
tar: -C: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
I realized that the f
flag was causing trouble as it expects the actual file. Omitting it, now lets tar complain for the relevant flag.
In case of the gz
:
tar: Archive is compressed. Use -z option
and in case of the xz
:
tar: Archive is compressed. Use -J option
Adding them makes my command work. Yet since tar is recognizing the archive format, I wonder:
Is there a way for it to extract them without adding the flag just like xf
?