LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Tar archive compression directory (https://www.linuxquestions.org/questions/linux-newbie-8/tar-archive-compression-directory-4175672654/)

subir 04-06-2020 11:51 AM

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?

ehartman 04-06-2020 11:57 AM

Quote:

Originally Posted by subir (Post 6108437)
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.

TB0ne 04-06-2020 12:27 PM

Quote:

Originally Posted by subir (Post 6108437)
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.


All times are GMT -5. The time now is 12:50 PM.