What Are TAR, GZ, and BZ2?

What kind of files have .tar, .gz, and .bz2 extensions?

If you’re someone who loves downloading software from the internet, you will most likely have encountered files with .tgz, .tar.gz, or even .tar.bz2. Still wondering what those files are? Well, read on and you will learn more about them.

What are TAR, GZ, and BZ2 anyway?

TAR is short for Tape Archive. It’s a common file format to use in the Unix/Linux world when you need to package source codes. A TAR file is just that, an archive. There’s no compression involved at all. You can think of a TAR file (or a tarball as some prefer to call it) as multiple files taped together.

So, what about the GZ and BZ2?

To compress a TAR file, you use tools such as GZIP. The resulting file will have a .gz added to its TAR file name. So if you compress myfilename.tar, running GZIP will give you myfilename.tar.gz. BZIP2 is another tool you can use to do the compression. As such, the resulting file will have a .bz2 extension added.

What’s with the two-step process?

It all boils down to UNIX philosophy of making small tools where each does one specific thing really well and can be chained together to do complex stuff. This persistence on small, specific tools also gives the user the freedom of which tools they want to chain together.

Which one is better – GZ or BZ2?

For compression and decompression time, GZIP is the definite winner. It is also very memory-efficient, making it an ideal choice for systems where memory is a scarce resource. BZIP2, on the other hand, is slower than GZIP, but it produces smaller compressed files by a good margin. You can expect a 15% decrease in compressed file size when you use BZIP2 over GZIP. It’s a significant factor to think about when you need to package large software. Smaller files translate to faster download and more file files fit into one DVD/flash drive.

Who uses TAR, GZ, and BZ2?

The Unix/Linux community still uses tar, gz, and bz2 extensively to distribute binary packages and source codes. The main reason is, well, because tar, gzip and bzip2 are bundled in almost all Linux distributions you can find. Why bother using other tools when you already have good ones at your disposal?

Are those three usable in a Windows ecosystem?

Yes, they are. While most Windows users prefer ZIP and RAR to archive and compress their files, they can easily create and extract .tar, .tar.gz, and .tar.bz2 files using tools such as 7-Zip. If you do not have it on your computer you can use the online archive converter tool to convert files or even archives to TAR.BZ2 or TAR.GZ.


Want to get in touch with us? Hit us up on our social media channels!