If you come across a .tar.gz, .tgz, or .gz file, you can use these steps to use the tar command-line tool to extract its content on Windows 10 using Ubuntu.

A file using. The tar.gz format is a file that was created using the Unix-based archive tar application and then compressed using gzip compression. These files are often referred to as “tarballs”, and while you can find them with a double extension (. Tar.gz), the extension can also be shortened to .tgz or .gz.

Usually, tar files are commonly used by Ubuntu and macOS users for data storage and backup, but sometimes Windows 10 users may come across these file types as well and may need to extract its contents.

While you can use some third-party apps like 7-Zip and PeaZip, sometimes these apps don’t play well with files created on other platforms. They slow down extracting a large number of files. However, Windows 10 includes a new subsystem for Linux that supports Ubuntu, Fedora, and SUSE, so you can also access a variety of Linux tools, including tar, to extract content from repositories quickly.

How to extract .tar.gz, .tgz, or .gz tarballs on Windows 10

To use tar on Windows 10, you must have Ubuntu installed. You can refer to the step-by-step guide if you are running the Creators Update or Windows 10 version. Before that, starting with the Fall Creators Update, you need to activate Windows Subsystem for Linux, use the Windows Features experience, and install Ubuntu from the Windows Store.

Once you have Ubuntu installed on Windows 10, use the following steps to extract a file. tar.gz :

1. Open Start.

2. Find Ubuntu and click the result.

3. Type the following command to extract the contents of  Tar.gz and press Enter :

sudo tar -xvzf /mnt/c/PATH/TO/TAR-FILE/Desktop/FILE-NAME.tar.gz -C / mnt / c / PATH / TO / DESTINATION / FOLDER

Giải nén file .tar.gz trên Windows 10- Hình 2

In the above command, we type sudo to run the application as an administrator, tar to call the application, and then we feed it some arguments, including:

  • X – tar instructions for which you want to extract the content.
  • V – verbose. This is an optional argument to show the extraction process. If not, you will only see the pointer blink until the process is complete.
  • Z – tells tar to extract the contents of one. The tar.gz file with gzip.
  • F – instructs tar the name of the file you are about to extract.

Then you need to specify the path of the tarball file you want to extract. You will notice that the path starts /mnt/c/, instead of c: , and this is because we are working in the Linux world.

-C – (hyphen and letter C ) is used to tell tar to change directories. When you are executing a command, you start in the source directory. You need to specify the destination directory, which is the path that we specified to complete the command. You can extract the files to any folder you want, but remember to start the path with /mnt/ followed by the Windows path.

You must pay attention to upper and lower case letters while typing commands in Linux because Desktop is not the same as desktop.

Once you’ve completed the steps, you should have all the files and folders extracted to the destination path you specified after a few minutes.

It’s worth noting that assuming you are mining a tarball that was already created on another system, so we omit some arguments that are often needed to protect permissions; in Windows 10, it’s not necessary to access files.

Also, in this tutorial, we are looking at the necessary steps for performing a specific task. If you are not a Linux user, there is a lot to learn about tar. If you want to learn more about this tool, visit the Ubuntu tar --help control panel.