Does tar really "compress" files ?

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
dunome

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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Mute Ant

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.
User avatar
thx-1138
Level 8
Level 8
Posts: 2092
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: 888
Joined: Tue Jun 29, 2010 12:59 pm

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)
User avatar
Flemur
Level 20
Level 20
Posts: 10096
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 pmNot 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?
Locked

Return to “Beginner Questions”