Difference in .tar.gz and first gz and then tar
gunzip, linux, tar
Solution
Because zip process in general is more efficient on big sample than on small files. You have zipped 100 files of 1ko for example. Each file will have a certain compression, plus the overhead of the gzip format.
file1.tar -> files1.tar.gz (admit 30 bytes of headers/footers)
file2.tar -> files2.tar.gz (admit 30 bytes of headers/footers)
...
file100.tar -> files100.tar.gz (admit 30 bytes of headers/footers)
------------------------------
30*100 = 3ko of overhead.
But if you try to compress a `tar` file of 100ko (which contains your 100 files), the overhead of the gzip format will be added only one time (instead of 100 times) and the compression can be better)
Problem
I made two compressed copy of my folder, first by using the command `tar czf dir.tar.gz dir` This gives me an archive of size ~16kb. Then I tried another method, first i gunzipped all files inside the dir and then used ``` gzip ./dir/* tar cf dir.tar dir/*.gz ``` but the second method gave me dir.tar of size ~30kb (almost double). Why there is so much difference in size?