Difference Between GZIP and TAR

In Short:
1. Gzip is a compression tool used to reduce the size of a file
2. Tar is an archiver used to to combine multiple files into one
3. Gzip and Tar are usually used in tandem to create Tarballs that are compressed significantly
4. Extracting an individual file can take a lot longer with zipped tarballs than with other formats

Brief:-

GZIP vs TAR
The .tar.gz extension is a very popular one when downloading files especially in non Windows operating systems. But unlike most extensions, this is not meant to identify a single program that would be used to open this file; it points to two. Tar is a file format but is also the name of the program that produces the file. Tar is an archiver, meaning it would archive multiple files into a single file but without compression. Gzip which handles the .gz extension is the compression tool that is used to reduce the disk space used by the file.

Most Windows users are used to having a single program compress and archive the files. Some of the programs that do this are Winrar, 7zip, and Winzip. But this is not the case in the UNIX and Linux environments where archiving and compressing are two different operations altogether. Tarball is the name used to identify any collection of files that have been archived into a single file by the Tar application whether it is compressed or not. Although Gzip is the most common compression tool that is used with tarballs, it is not the only one. There is also another compression tool called Bzip2 that could compress the file further but would take a lot longer.

There are advantages and disadvantages in creating a zipped tarball compared to the standard applications that does both. A zipped tarball could have dramatically reduced filesize the compression tool is not compressing the files individually but treating the whole tarball as one big file. This is even more apparent when dealing with semi compressed files like GIF and JPG files.

The disadvantage of using this format is that you would be unable to extract a single file. Since the entire archive is compressed as a whole, you would also need to uncompress the whole archive before extracting a single file. Extracting a single file from a large zipped tarball could take significantly longer compared to extracting a single file from the same files compressed and archived by a different tool like Winrar or Winzip.

Leave a Reply

Your email address will not be published. Required fields are marked *