LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (http://www.linuxquestions.org/questions/general-10/)
-   -   tar extracts gzip file even without -z flag (http://www.linuxquestions.org/questions/general-10/tar-extracts-gzip-file-even-without-z-flag-4175455652/)

ajayyadavmca 03-26-2013 08:15 AM

tar extracts gzip file even without -z flag
 
Hi, i was creating tar archive with tar command and extracting it.

To create tar: tar -cvzf test.tar.gz /test
To extract: tar -xvf test.tar.gz

extract command was a mistake, i should have used -z option for gzip filter. but interestingly it works even without -z. i couldn't found any useful reference on Google why it works.

I have CentOS 6.2 linux.

Can you please help me understanding why tar extract work for gzip archive without using -z flag? Is it expected?

yowi 03-26-2013 08:29 AM

I guess the -a (--auto-compress use archive suffix to determine the compression program) option is a default, or maybe your site has TAR_OPTIONS set.

sycamorex 03-26-2013 08:57 AM

Perhaps, this one:

Quote:

Compressed archives are recognised automatically, it is no longer necessary to specify -Z, -z, or -j options to read them. Thus, you can now run tar tf archive.tar.gz and expect it to work!
Source: http://www.gnu.org/software/tar/

gnashley 03-26-2013 11:33 AM

The '-a' option is in since tar-0.15, IIRC.


All times are GMT -5. The time now is 03:35 AM.