LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 06-10-2004, 08:20 AM   #1
linuxzouk
Member
 
Registered: Apr 2004
Location: Malaysia
Distribution: Fedora Core
Posts: 93

Rep: Reputation: 15
why gz it when it has been tar?


i noticed some packages comes in
package.tar.gz

why gz it when it's already a tar
double compression???
 
Old 06-10-2004, 08:26 AM   #2
Dobie
Member
 
Registered: Nov 2003
Location: Halifax N.S.
Distribution: Mandrake 9.1
Posts: 35

Rep: Reputation: 15
Eh dere..
Tar places files together such as all your short stories into one file to be ftp'd somewhere...
gz'ing a file compresses it.


Tar (i believe -me a noob) has the ability to use gzip when you tar..or you can use it seperatly.
Tho i'm 3 days into linux (mandrake), and when I've used tar.gz files...I seam to need to gunzip it first..
then untar it? Guess there's more rtfm'ing for me
 
Old 06-10-2004, 08:30 AM   #3
SBing
Member
 
Registered: Mar 2004
Posts: 519

Rep: Reputation: 35
I believe:

tar has no compression, it simply adds file1+file2...+fileN > files.tar

this is because gzip can only handle 1 file at a time, so all the files need to be put into a single file.

Therefore, it is only compressed once at the gzipping stage :)

Steve
 
Old 06-10-2004, 08:34 AM   #4
gowator
LQ Newbie
 
Registered: Jun 2004
Posts: 13

Rep: Reputation: 0
Tape Archive Format

A tar by definition cannopt include compression because then tape drives own hardware compression wouldnt work.

Somehow along the way so many people came from windows to *nix that people started to think tar was some file format when its exactly the opposite...

its made to be open to be used on any tape drive and even on a disk file....
Becuase this is *nix there is a choice of compression inclding BUT certainly not limited to bzip/bz2 to compress (.Z) to gzip .gz


linuxzouk is correct it concatonates files together ... that is the job of tar whether to tape or disk.... it would be silly and irrelevant to build in compression, for instance why compress a directory of jpeg's since they are already compressed its just a waste of CPU...
you might wantto stream a file over ppp for instance using compression so then you would just create extra work for the compression on say a modem....

Quote:
...I seam to need to gunzip it first..
tar -xvfz <file> will unzip and untar said file !!!
 
Old 06-10-2004, 08:36 AM   #5
linuxzouk
Member
 
Registered: Apr 2004
Location: Malaysia
Distribution: Fedora Core
Posts: 93

Original Poster
Rep: Reputation: 15
now i know a little bit more

thanks all
 
Old 06-10-2004, 09:09 AM   #6
Cage47
Member
 
Registered: Feb 2003
Location: Pasadena, TX
Distribution: Debian Lenny
Posts: 220

Rep: Reputation: 31
But then again why tar.gz when bzip2 compresses even smaller.
 
Old 06-10-2004, 09:27 AM   #7
Dobie
Member
 
Registered: Nov 2003
Location: Halifax N.S.
Distribution: Mandrake 9.1
Posts: 35

Rep: Reputation: 15
Sorry there.. I didn't quite say what I ment to say there (ie -> ...such AS IF you wanted to ftp it somewhere or do something else with it...archive..etc...)

Question - Tar does have the ability to call for gzip (bzip?) to be done after it has tar'ed the files together does it not? z flag?

Thanks
 
Old 06-10-2004, 10:48 AM   #8
Nis
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: Ubuntu Hoary (5.04)
Posts: 550

Rep: Reputation: 31
Most source come in tar/bzip2 format now the Linux kernel being an example. I speculate the reason tar/gzip is still widely used because it has been used for a long time. bzip2 takes more CPU time to decompress and so for older machines 4 years ago, gzip worked fine. I know Pat went with tar/gzip for Slackware packages long, long ago, but I wish now that it would switch to tar/bzip2 or at least support it. bzip2 really does compress a whole bunch. My nightly backup of /etc goes from 20 MB to 5 MB with bzip2.
 
Old 06-11-2004, 05:16 AM   #9
gowator
LQ Newbie
 
Registered: Jun 2004
Posts: 13

Rep: Reputation: 0
Quote:
Originally posted by Dobie
Sorry there.. I didn't quite say what I ment to say there (ie -> ...such AS IF you wanted to ftp it somewhere or do something else with it...archive..etc...)

Question - Tar does have the ability to call for gzip (bzip?) to be done after it has tar'ed the files together does it not? z flag?

Thanks
Yep but the nice thing is doesnt matter ... thats linux or *nix more accureatly...
yep it can use gzip/bzip2 etc. and the options depend if its symmetric or asymmetric compression/decompression.
mp4 is very asymmetric for instance it takes heaps of CPU to encode but almost nothing to decode..

If you are compresing a file to be used by 1000's then the CPU needed to compress it is trivial compared to 1000's decompressing...
 
Old 06-11-2004, 10:20 AM   #10
Dobie
Member
 
Registered: Nov 2003
Location: Halifax N.S.
Distribution: Mandrake 9.1
Posts: 35

Rep: Reputation: 15
Thanks gowator.

May be a bumpy road to figure this all out... but so was windows when i first started there..
hmmm..kind of miss the old config.sys, autoexec.bat, win.ini, system.ini, win.ini...the few others...
These days my firewall informs me about
kernal32 / system / other is trying to contact..... would like to allow it...

5 scvhost files are in use for programs undisclosed ....
Well back to
 
  


Reply


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
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 11:55 AM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 12:02 PM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 01:08 PM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 07:30 AM


All times are GMT -5. The time now is 02:12 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration