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.
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.
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.
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.
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.
- › Everything New in Windows 10’s May 2019 Update, Available Now
- › How to Unzip or Extract tar.gz Files on Windows
- › How to Download Files and Folders From Google Drive
- › What Is A 7Z File (And How Do I Open One)?
- › How to Convert Linux Installation Packages to Other Formats
- › How to Boot Multiple Linux Distributions With Ventoy
- › How to Fix Error Code 0x80004005 on Windows 10 and 11
- › Bose QuietComfort Earbuds 2 Review: A Step Forward for Noise Cancelling Audio