I've checked these two questions (question one, question two), but they were not helpful for me to understand. I have a file file.txt
with 40 lines of Hello World!
string. ls -l
shows that its size is 520 bytes. Now I archive this file with tar -cvf file.tar file.txt
and when I do ls -l
again I see that file.tar
is 10240 bytes. Why?
I've read some manuals and have understood that archiving and compressing are different things. But can someone please explain how it is working?
tar
by itself does not do any compression. So the output tar file will always be larger than the input file. That's why tar files are usually ran through a compressor likegz
. – Colonel Thirty Two Jan 10 '22 at 20:19.tar
file to check the contents? – Bert Jan 11 '22 at 00:07gz
” – well, they often are, but I wouldn't say “usually”. It certainly doesn't always make sense, in particular not when the archive contains e.g. compressed video files where another layer of general-purpose compression is completely useless but may take significant computation resources. – leftaroundabout Jan 12 '22 at 12:12ls
ordir
. – René Nyffenegger Jan 13 '22 at 07:00