A tar file, often called a tarball, is a collection of files wrapped up in one single file for easy storage. Rather than keep track of a whole folder of files, you only need to keep track of one. Tar files are often compressed after being created, giving it the .tar.gz file extension. Technically these are TGZ files, but nearly everyone calls both .tar and .tar.gz files simple “tar files.”

The term “tar” was derived from “tape archive”, as it was originally designed for use with devices like tape drives that didn’t have a regular file system—all the way back in the Version 7 Unix released in 1979. Tar has been supported since then on almost every platform outside of Windows. Interestingly enough, the latest versions of Windows finally include native support for tar in the command prompt, but they can’t handle gzip, making it almost entirely useless since almost every tar archive is compressed with gzip or bz2 as well.

How Do I Open a Tar File?

If you’re on macOS or Linux and don’t mind using a terminal, it’s just a single command (where tarfile is the name of your file):

tar -xzf tarfile

There are also a few flags you can add to the command to have it perform slightly different functions:

  • -v: Enables verbose mode, showing the progress of the command
  • -x: Extract
  • -z: Uses gzip, omit this if you just have a .tar
  • -f: specifies file input, rather than STDIN

Those last three flags can be a little hard to remember on the spot, so a good mnemonic to use is “Xtract Ze File.” You can also pretend you’re the Terminator when you run it.

Creating a tar file is just as easy. Just replace the -x with a -c to “Create,” though I find it easier to remember by “Compress,” even though that’s -z’s job.

RELATED: How to Compress and Extract Files Using the tar Command on Linux

Opening Tar.gz Files on macOS Is Easy

For those that don’t like using a terminal, you’ll be delighted to hear that macOS can open tar and tar.gz files by default with the Archive Utility. Just double click on the file, and it will extract.

opening tar.gz on macOS

You can also use The Unarchiver, which is a free tool for managing archives, functions just like the Archive Utility, and supports .rar files as well.

Of course, you can still use the terminal on a Mac to handle all your extracting, and since most power users these days are working from a Mac, that’s probably where most terminal action is happening.

What About Opening Tar.gz Files on Windows?

You’ll need an external program to open tar.gz files on Windows. 7-Zip is lightweight and does the job well, though it takes two steps to open tar.gz files. WinRar opens them in one step but is slightly clunkier to use.

Once you’ve installed 7-Zip and assigned it to handle tar.gz files on Windows, you can drill down into archives, extract specific files, or just extract the entire folder to a location on your drive.

using 7zip to open tar.gz files

RELATED: Best Linux Laptops for Developers and Enthusiasts

Profile Photo for Anthony Heddings Anthony Heddings
Anthony Heddings is the resident cloud engineer for LifeSavvy Media, a technical writer, programmer, and an expert at Amazon's AWS platform. He's written hundreds of articles for How-To Geek and CloudSavvy IT that have been read millions of times.
Read Full Bio »
Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »