Does tar really "compress" files ?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
dunome
Level 1
Level 1
Posts: 17
Joined: Thu Jun 07, 2018 3:02 pm

Does tar really "compress" files ?

Post by dunome »

Hello !

I use "tar" (tar.gz) during a while now (it's not like I had much of a choice actually :P ), but I'm really questionning its efficacy. Does it really compress files ?

I mean, apart from archiving files, isn't it supposed to "reduce" the size of all the files at the same time.

For example, if I compress 2x2GB files (4GB), my archive is 4GB as well. Normally it is like 2,8GB right (example), or I am totally wrong ?

Thanks for your help
Mute Ant
Level 14
Level 14
Posts: 5129
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: Does tar really "compress" files ?

Post by Mute Ant »

Strictly, no, tar does not compress anything. tar comes from Tape-And-Rewind which stacks the files end-to-end to send them to a serial storage device, like a tape recorder. The gz part is the compression, but it's not magic. If there's no redundancy in the data, such as a collection of JPEG files, the 'compressed' output can even be slightly larger than the originals.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".
User avatar
thx-1138
Level 8
Level 8
Posts: 2114
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Does tar really "compress" files ?

Post by thx-1138 »

...as Mute Ant said...any 'reduction' is done by external algorithms:
check in a terminal tar --help, scroll down a bit to see the currently supported ones...
Ie. for up-to-date 'scientific' comparisons of such with different datasets as input,
i guess you could google something like bzip2 vs gzip vs lzma vs xz etc...
User avatar
Bolle1961
Level 5
Level 5
Posts: 739
Joined: Tue Jun 29, 2010 12:59 pm
Contact:

Re: Does tar really "compress" files ?

Post by Bolle1961 »

Mute Ant wrote:
Sat Jun 23, 2018 10:51 am
tar comes from Tape-And-Rewind which stacks the files end-to-end to send them to a serial storage device, like a tape recorder.
Not quite right, it comes from tape archive
https://en.wikipedia.org/wiki/Tar_(computing)
“Only when the last tree has been cut down, the last fish been caught, and the last stream poisoned, will we realize we cannot eat money.” ― Cree Indian Prophecy
Image
User avatar
Flemur
Level 18
Level 18
Posts: 8817
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Does tar really "compress" files ?

Post by Flemur »

Bolle1961 wrote:
Sat Jun 23, 2018 1:15 pm
Not quite right, it comes from tape archive
I actually used it for that, way back in the time of tapes.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Post Reply

Return to “Newbie Questions”