Open and Extract .tar files on Windows
What I’m about to say might be a surprise to you… But you don’t need to install any sort of 3rd party software (like 7zip or WinZip) to extract tarball files on WIndows. Windows 10 actually has the functionality built-in. I know, I was just as surprised to learn about it as you are. From the command line, you can use the “Tar” command to easily extract .tar, .gz, or tar.gz files.
For folks out there that don’t know;
- A tarball file, ‘.tar’, is just a type of archived file. They are basically, a collection of files that have been merged into one single file.
- Gzip files, ‘.gz’, are a type of compressed file and it is used to save on the amount of space that a file uses on the hard drive.
- If you’re following along, then you’ll already have realized that a ‘.tar.gz’ file means that it is just a compressed archive file.
Here’s how to extract your tarball file in Windows 10.
Open the ‘Start Menu’ and search for “cmd”. Right-click on “Command Prompt” and select “Run as administrator“.
Enter the following command inside the window.
tar -xvzf "Path to file" -C "Path to destination"
Example:
tar -xvzf C:\Source\file.tar.gz -C C:\Destination\
This example will extract the contents of the ‘file.tar.gz’ file from the “C:\Source\” folder to the “C:\Destination\” folder.
Note: Make sure the ‘-C’ parameter before the path to the destination is an uppercase.
The parameters explained:
- x — instructs tar to extract the archived content.
- v — verbose mode. This is optional to display the extraction process. Otherwise, you will only see a blinking cursor until the process is complete.
- z — instructs tar to uncompress the content with gzip.
- f — provides tar the name of the file you’re about to extract.
- –C — uppercase and with a hypen, this tells tar to change folders to the specified folder