LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2020, 12:51 PM   #1
subir
LQ Newbie
 
Registered: Nov 2019
Posts: 22

Rep: Reputation: Disabled
Tar archive compression directory


I used tar to archive directory, then i used gzip to compress the directory.
But when I used tar -xvf a.tar.gz I got my original file. Why without unzip it I got my original file?

Last edited by subir; 04-06-2020 at 12:52 PM.
 
Old 04-06-2020, 12:57 PM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885Reputation: 885
Quote:
Originally Posted by subir View Post
Why without unzip it I got my original file?
Newer versions of tar automatic detect, from the extension, the type of compression used and will pipe the input through the appropiate DEcompression command.
See i.e. the paragraph "Compression options" in the man page.

PS: tar can apply the compression too when creating the archive.
 
1 members found this post helpful.
Old 04-06-2020, 01:27 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,500

Rep: Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722Reputation: 6722
Quote:
Originally Posted by subir View Post
I used tar to archive directory, then i used gzip to compress the directory. But when I used tar -xvf a.tar.gz I got my original file. Why without unzip it I got my original file?
Did you read the man page on tar??? You've asked about it in the past, so it would make sense that you would investigate how it works and why. Tar did exactly what you asked it to do.
 
  


Reply

Tags
gzip, tar, tar.gz


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
Slax with SquashFS-4 new compression algorithm and layered compression ratios? lincaptainhenryjbrown Linux - Software 2 06-19-2009 06:29 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM
How do I un tar a .tar, .tar.z, .tar.gz file vofkid Linux - Newbie 4 03-15-2002 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:10 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