A Tape Archive file, or TAR, for short, is a way to package source code for downloading purposes or bootable ISO image. The basic .tar files are uncompressed, but they can be compressed into .tar.gz or .tar.bz2 to take up even less space. In a Linux environment, .tar is the de facto standard for making source code available for download, but you can so unzip it in Windows and Mac if needed. This article shows you how to do it in detail steps..
How to Unzip or Unpack .tar.gz or .tar.bz2 File on Windows 10
In Windows 10, there are several options to unzip or, more accurately, untar such files. For example, use can use a command line tool like TarTool or a full-fledged archive utility like 7-Zip, which offers a nice graphical interface or GUI. In the following section, we'll show you how to use 7-Zip in the command line as well as through the GUI.
Step 1: Download and install 7-Zip. Skip to Step 5 if you want to use the graphic user interface.
Step 2: Go to Start -> Control Panel -> System -> Advanced -> Environment Variables to add the 7-zip installation directory to path.
Step 3: Put the file to be extracted into the destination directory. Open CMD and cd to that directory. Then, if the file is compressed, run one of these commands: 7z x filename.tar.gz
Step 4: You either have to run both commands or just the second one. The first one can be replaced with filename.tar.bz2 or whatever the name of your TAR file. The file will download into a directory within the directory with all your files extracted.
Step 5: Using the 7-Zip GUI is easier for most people, so if you want to do that, use the File Manager to simply open the file and 7-Zip will do the rest.
How to Extract or Uncompress .tar.gz or .tar.bz2 File on Mac
In macOS, the process is too simple to require an explanation - just double-click on the icon and Mac will launch The Unarchiver app to extract the file. However, as in the case of Windows, you may need to unpack it twice. If you'd rather use the Terminal app with some command line input, you can do the following:
Step 1: First of all, move the .tar.gz or .tar.bz2 file to a directory that you can remember.
Step 2: Make sure you have a Terminal shell running, then go to the directory where the TAR file was copied.
Step 3: Run the following command( tar -xyz foo.tar.gz). This command will create the extracted files in the same directory. If you don't know what they contain, you can also modify the command slightly to get a list of extracted files as they're created.
Step 4: The tar command works with .tar.gz and .tar.bz2 files, but if you have a .tar file, use the following command instead: tar xopf foo.tar
Both Windows and Mac have the default tools required to extract TAR GZ files but, as you can see, most of them require a little hands-on experience in Command Prompt or Terminal. You can also choose a premium file compression utility and easily get it to do the job in a couple of clicks, but it's good to be aware of free methods and tools in case you're in a pinch and need to urgently unpack .tar.gz and .tar.bz2 file.