5 ms·
well, with gnu tar I prefer to use: -a, --auto-compress use archive suffix to determine the compression program So tar cvfa archive.tar.xz files* woul
by slug 15y ago
well, with gnu tar I prefer to use:
-a, --auto-compress
use archive suffix to determine the compression program
So tar cvfa archive.tar.xz files* would create a tar.xz file
- strager 15y agoDoesn't work when piping the file to `tar`, though (e.g. `curl http://. http://.. | tar x`). I've thus gotten in the habit of specifying the format I expect.
- chalst 15y ago-a only works when creating the tarball anyway. `file`-like auto-decompress could work, though: these formats have magic numbers, and tar already has the data in its zip_magic struct: http://svn.netlabs.org/repos/ports/tar/trunk/src/buffer.c http://svn.netlabs.org/repos/ports/tar/trunk/src/buffer.c together with code to infer compression type. I guess the only reason why tar doesn't support this already is caution.
- LukeShu 15y ago-a does work with decompression, what version are you using? I'm using GNU tar 1.26, and just successfully used "tar xaf firefox-9.0.1.source.tar.bz2".
- slug 15y agodecompressing there's actually no need to use -a, you can do tar xf firefox-9.0.1.source.tar.bz2 (tar 1.25 here).
- chalst 15y agoIf you explicitly provide a file by path, then tar doesn't use magic number autodetect, but uses file extension dispatch instead. You would need to pass the data as a stream to force magic number autodetect: <firefox-9.0.1.source.tar.bz2 tar xaf - Does that still work? It doesn't for me. I was using (GNU tar) 1.20 and Debian stable is now at 1.23, but I think that autodetect code went in around 1.18.