You are here

Zip, bzip, gzip, or 7zip?

Submitted by Peter on Fri, 2010-12-24 18:20

When you compress a file, should you use the Zip format or the Gzip format or Bzip, Bzip2, or 7-zip? Here is the definitive answer.

7-zip

7-zip produces the best compression. Few people use 7-zip despite it being free and working on every operating system. If you are going to send a file to someone else, ask them before using 7-zip. 7-zip does not compress files over 2 GB.

I install the 7-zip program on every Windows machine because the 7-zip program will read and decompress almost every type of compressed file plus it adds useful compression and decompression actions to Windows Explorer and the right click menu for files. I have not tested 7-zip on my Ubuntu Linux machines.

Bzip

Bzip produces the next best compression. Bzip is common in the Linux/Unix world but is still not the standard. The people creating Linux distributions and a lot of the Unix people writing how-to pages on the Web like to pick the absolute oldest possible technology for everything. Bzip was released back in 1996 but gzip dates from 1992, making gzip more mature.

Some Web sites offer downloads in Bzip format and also offer the downloads as gzip for old Linux systems.

Bzip is actually bzip2 but everyone calls it bzip. The original bzip appeared for only a short time then was replaced by bzip2.

Gzip

Gzip might be a little faster at compressing than Bzip but the difference is not noticeable on a modern computer and the resultant file is significantly larger than the bzip equivalent. Gzip appears to be recommended over bzip mainly because the dinosaurs in the Linux/Unix world remember a day back in the last century when they tried to compress a file on an IBM 5150 left over from 1980 and bzip took two seconds longer than gzip.

Gzip is the safest format when sending a compressed file to a dinosaur using Linux.

Zip

Zip is the standard on the Windows operating system. Everyone has it. Use Zip if you are sending a file to someone using Windows. Also suggest they install 7-zip because 7-zip handles Zip, gzip, bzip, 7-zip, and some other formats.

Compression comparison

The following table shows a size comparison for a database export as SQL without compression then with various types of compression.

Type Size in megabytes
Uncompressed   12.957
Zip 1.137
gzip 1.137
bzip 0.726
7-zip 0.666

 

Maximum file size

Some compression programs and file formats have limitations around 2 gigabytes, something worth testing before relying on the compression technique for large files. 7-zip failed when compressing a file over 2 GB.

Some file systems also have a file size limitation of 2 GB, a consideration when you want to send a large compressed file to another computer. You should be safe using an old file on a new computer. You might run into problems when you use an old computer as an emergency replacement for a broken new computer and have to decompress a large backup.

The Ext4 file system in Linux and the NTFS file system in Windows both handle the largest file you can fit on the largest practical array of disks. The FAT file system used on flash memory cards is available in several versions and most have a 2 GB file size limit.