LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 03-26-2013, 08:15 AM   #1
ajayyadavmca
LQ Newbie
 
Registered: Dec 2006
Posts: 28

Rep: Reputation: 0
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?
 
Old 03-26-2013, 08:29 AM   #2
yowi
Member
 
Registered: Dec 2002
Location: Au
Distribution: Debian
Posts: 209

Rep: Reputation: 55
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.
 
Old 03-26-2013, 08:57 AM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
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/
 
Old 03-26-2013, 11:33 AM   #4
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
The '-a' option is in since tar-0.15, IIRC.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] tar + gzip/bzip2 with big file size limitation/solution limdel Linux - Newbie 3 03-24-2012 10:29 AM
tar file twice? put to tape? Gzip? jantman Linux - Software 4 03-25-2007 03:01 PM
invalid gzip magic (tar.gz file) hkhiroya Debian 2 05-23-2006 06:35 AM
How to unzip and untar a xxx.tar.gzip.part file> linuxharsha Linux - Software 8 02-15-2004 04:27 AM
How to untar and unzip .tar.gzip.part file? linuxharsha Linux - Software 2 02-14-2004 10:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration