How to Extract or Unzip tar.gz Files in Linux

how to untar tar gz file

The most often used algorithm for compressing tar files is Gzip. By convention, the name of a tar archive compressed with gzip becomes .tar.gz or .tgz. With the command prompt open, use the appropriate commands to change the current working directory (cd) to the location of the .tar.gz file you want to unzip. Alternatively, you can also specify a source and destination file path when using the tar utility. From videos to entire software packages, many files are compressed and stored using the .tar.gz format.

If the command line isn’t your thing, there are plenty of user-friendly tools available to unzip tar.gz files. But with .zip being the easier of the two to use, why use .tar in the first place? The next section shows how .tar comes with a few extra features that make it the better compression format for certain files and applications.

You can notice in the above image that the archive files are extracted in the same working directory. This format is common in the Unix/Linux world and is widely used to create compressed archives. The following article will help you to extract (unpack) and uncompress (untar) – tar, tar.gz and tar.bz2 files from the Linux command line.

How to Unzip .tar.gz in Linux using tar

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. This error usually occurs when a .tar has been saved as a .gz despite having never been compressed using the gzip utility.

To do this we’ll use liability debt and leverage defined explained calculated almost exactly the same command as before but with one important difference. The .bz2 extension suffix tells us it has been compressed using the bzip2 command. Instead of using the-z (gzip) option, we will use the -j (bzip2) option to unzip the bz2 file. If you want to extract the files to a location other than the current directory, you’ll need to specify a target directory using the -c option (specified directory).

  1. Ubuntu is a Southern African philosophy and term originating from South Africa and Zimbabwe.
  2. Perhaps you might also be interested in learning how to unzip files in Linux.
  3. Moreover, if you want to extract the tar file at different location you can use the option -C, which specifies change to directory before performing any operations.
  4. It signifies the strong sense of community and interconnectedness at the core of Ubuntu’s philosophy.
  5. Simply add a space-separated list of the files you want to extract.

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

This means it takes all the specified files and puts them together into one container. Looking in our Documents/Songs directory we’ll see the Guitar Songs directory has been created. Ubuntu Core is a minimalistic and immutable version explicitly designed for the Internet of Things (IoT) and embedded systems. Or, if you want to use absolute path you can run the following command.

How to List Contents of .tar.gz File in Linux

While experienced users know what is a TAR file and how to extract it, Linux newbies might face some difficulties in figuring out what to do with it. After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools. In this guide, you will learn how to extract or unzip .tar.gz files in Linux. 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. You can open most .tar.gz files using the tar command built in to Linux, macOS, and Windows 10.

how to untar tar gz file

how to untar tar gz file

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. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004.

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. Where .zip files consist of many individually compressed files, .tar files are compressed as a single package, leaving its files uncompressed. In other words, .zip files are a collection of compressed files, while .tar files are a compressed collection of files.

You don’t need to untar tar.gz files every time you want to add a new file to the archive. If you’re using a Linux OS, you can open the tar archive just as you open any other directory. You’ll notice that you don’t need to use the -z option to list the files. You only need to add the -z option when you’re extracting files from a .tar.gz file. To untar tar.gz files just means to extract the contents of the tar file (also known as a tarball).

The number represents how many levels of directories to ignore. Files from the ignored directories are still extracted, but the directory structure is not replicated on your hard drive. So far we’ve just taken a leap of faith and extracted the files sight unseen. You can review the contents of a tar file before you extract it by using the -t (list) option.

As you might imagine, using a different compression utility on a .tar file will result in a different double extension. Some common examples include .tar.bz2 (bzip2), .tar.br (Brotli), and .tar.zst (zstd), among many others. 7-Zip is a free and open-source tool with high compression ratios & supports a wide range of archive formats.

Önceki Yazılar:

Sonraki Yazılar: