How To Extract and Unzip tar.gz Files for Linux & Windows - Solar Pool Heating Tucson

how to untar a tar.gz file

You can follow him on X (Twitter), YouTube, LinkedIn and About.me. On Windows 10, to use tar on Linux, you need to install the Windows Subsystem for Linux (WSL) and a distro like Ubuntu from the Microsoft Store. For more information and to schedule a live demo, contact a hosting expert from Kinsta today. The Ubuntu logo, often called the “Circle of Friends,” comprises three people holding hands. It signifies the strong sense of community and interconnectedness at the core of Ubuntu’s philosophy. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004.

How to Extract/Unzip .tar.gz Files: Step-by-Step Windows and Linux Guide

When the archive is extracted, these attributes are restored. That means they maintain their original characteristics. This compression is lossless – that means no data is lost during the compression process, and the original files can be fully restored upon extraction. Files that have a .tar.gz or a .tar.bz2 extension are compressed archive files. A file with just a .tar extension is uncompressed, but those will be very rare. This error occurs when trying to extract specific files or directories from a .tar.gz file using tar.

The following article will help you to extract (unpack) and uncompress (untar) – tar, tar.gz and tar.bz2 files from the Linux command line. You can open most .tar.gz files using the tar command built in to Linux, macOS, and Windows 10. If you’re not comfortable with the terminal or command line, third-party tools such as 7-Zip offer a more user-friendly alternative. It’s easy to get confused when navigating between .tar, .tar.gz, and .gz – not to mention zipping and unzipping them. Here are a few frequently asked questions we commonly hear from users working with .tar.gz files.

.tar.gz Files

Though both .zip and .tar.gz archive and compress files, they do so in different ways. In other words, .zip is a collection of compressed files, while .tar.gz is a compressed collection of files. As we see later, different compression utilities may require different methods for extracting and unzipping files. Though we mostly focus on .tar.gz files, check out the end of the article for some quick tips on extracting .tar files in other formats. Just like the more familiar .zip files, .tar files compress large files into a single package, making it easier to store and send them through email, servers, and so on. As a result, it has become a common file extension for many open-source software packages and other resources.

Related Articles

how to untar a tar.gz file

Ubuntu LTS (Long-Term Support) versions, known for their stability and extended support periods, are typically released every two years in April. These are popular for organizations and users who require a reliable and well-supported Ubuntu operating system. Many of the downloadable Linux/Unix files found on the internet are compressed using a tar.gz format. Therefore, knowing how to open or untar tar.gz files is very useful.

  1. As you might imagine, using a different compression utility on a .tar file will result in a different double extension.
  2. You can create your own compressed .tar files using compression utilities such as gzip.
  3. Similar to the previous error, this error occurs when an archive was saved as a .tar despite not being a .tar archive.
  4. Right-click the first result and select the “Run as administrator” option.

Zip and unzip .tar and .tar.gz in Linux with gzip

Notice that we don’t need to use the -z option to list the files. We only need to add the -z option when we’re extracting files from a .tar.gz file. Likewise, we don’t need the -j option to list the files in a tar.bz2 file. If we want to extract the files to a location other than the current directory, we can specify a target directory using the -C (specified directory) option.

What command do I need to unzip/extract a .tar.gz file?

The tar command will work happily with both types of file, so it doesn’t matter which compression method was used — and it should be available everywhere you have a Bash shell. You just need to use the appropriate tar command line options. You will learn how to list the contents of a tar archive without unpacking it and how to extract only a single file or a single directory. Usually, tar files are more common with Ubuntu (other Linux distros) and macOS users for data archival and backups. However, Windows 10 users may also come across these files, which is a reason to have a way to extract their contents. The tar command also provides support for extracting only specific files or directories from a .tar.gz file.

It may sound like a silly mistake, but it’s surprisingly common in situations where users directly rename files and their extensions (such as .tar and .gz) in the process. This command extracts (-x) the file (-f) specified (in this case, filename.tar.gz) to the current directory. Note that this command also works with other common compression formats such as .tar.bz2.

It was contained in the tar file, and was extracted along with the files. A file using .tar.gz format is a file that has been created using the Unix-based archival application tar and then compressed using the gzip compression. These files are often referred to as “tarballs.” While you can find them with a double extension (.tar.gz), the extension can also be shortened to .tgz or .gz. Since .tar.gz compresses multiple files all at once, it can take advantage of similarities between individual files to save on space.

They were officially introduced in Ubuntu 16.04 LTS, released in April 2016. The -C option is used to specify a different directory other than the current working directory. This example uses example1.tar.gz in the Home directory.

Once you complete the steps, you will have all the files and folders extracted to the destination path you specified after a few moments. This guide will teach you the steps to use native tar commands on Windows 10 from Command Prompt and Ubuntu to extract the content of a .tar.gz file. In this example, the user tried to extract the file titled “FILE” from filename.tar.gz.

People new to the .tar format usually equate it to a .zip archive, but a tar archive is not compressed. Tar collected all the files into one package, but the files can be compressed with separate utilities. On the other hand, Windows users can rely on third-party file archiver tools like 7-zip or WinRAR to effortlessly extract files. In Linux, users have multiple ways to extract .tar.gz files – through the terminal and graphical file archivers. To extract all the files from a directory within a tar file how is phantom profit calculated use the following command. Note that the path is wrapped in quotation marks because there are spaces in the path.