JazZ
JazZ

Reputation: 4579

File compressed with tar gzip or zip has slightly the same size

I tried to compress the same file with different compression type :

tar cjf dump.sql.tar.bz dump.sql
tar czf dump.sql.tar.gz dump.sql
zip -r dump.sql.zip dump.sql

results :

size     file
79968725 dump.sql            ~77MB
 9846256 dump.sql.tar.bz     ~9.4MB
13863797 dump.sql.tar.gz     ~14MB
13863826 dump.sql.zip        ~14MB

The best compression comes with bzip2 file. Anyway, the original file was compressed with bzip2 but its size was around 7.7MB. How to get this level of compression ?

Is there some other compression types/options to get better performances ?

Also, why the gzipped file has slightly the same size as the zipped file ? I thought gzip had a better compression rate than zip. Am I missing something ?

Any tips/hints are welcomes and will be appreciated.

Thank you.

Upvotes: 1

Views: 3215

Answers (1)

zorglub23872
zorglub23872

Reputation: 301

Pretty much every compressor out there (it's the case for gz, bz2, zip and xz) lets you choose the compression level (usually from 1 to 9 for instance). The faster it compresses, the lowest the compression ratio. The slower it is, the better compression you get. The best lossless compressor I know of is xz. It should give you better compression than bz2:

vfcJ dump.sql.tar.xz dump.sql

What file size do you get with this?

Upvotes: 2

Related Questions