From my tests so far on OSX 10.8 and CentOS 5.5, it looks like tar
automatically deduces the compression type of an archive, i.e., I could do tar -xf <compressed archive>
instead of doing tar -jxf <bzip2 compressed archive>
or tar -zxf <gzip compressed archive>
.
I would like to know if I can depend on this automatic compression detection feature of tar, or is this feature new?
These are the tar versions I played with.
OSX 10.8 -- bsdtar 2.8.3 - libarchive 2.8.3
CentOs 5.5 -- tar (GNU tar) 1.15.1
Thanks,
It appears that modern gnu-tar is able to auto-detect all compression types, as mentioned here. So to answer your question, no you don't have to specify type, and yes tar -xf
will always work fine.