4 ms·
with just enough differences to make them incompatible with each other. It stopped being funny when tar ran out of letters. -Z = compress, -z = gzip, -j = bzi
by moe 15y ago
with just enough differences to make them incompatible with each other.
It stopped being funny when tar ran out of letters.
-Z = compress, -z = gzip, -j = bzip2, -J = XZ
Now for lzip they had to resort to --lzip...
- ars 15y agoq e and y appear to be available (according to my man page). There should be some kind of rule that if you run out of option letters your program is doing too much. For comparison ls has e j and y available.
- dvanduzer 15y agoI am pretty sure someone's implementation (Sun?) of tar used y for bzip2 at some point.
- slug 15y agowell, 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.
- ketralnis 15y agoBut honestly doing the compression in tar instead of through a pipe doesn't actually help very much
- ams6110 15y agoIndeed, isn't this contrary to the unix way? Use tar for archiving, and pipe it through whatever compression utility you want.
- deleted 15y ago[deleted]