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

how to extract tar.gz

Knowing how to unzip a .tar.gz file allows users to extract and access the archives’ contents efficiently. A “.tar” file is a collection of files compressed into a single file or archive. Short for “Tape ARchive,” the name “TAR” is a throwback to when files were stored on magnetic tape drives. If you want to create your own tar.gz file, you can use the tar command with the -c option, which tells tar to create a new archive. You also need to use the -z option to compress the archive with gzip, and the -f option to specify the file name.

How to Extract or Unzip a tar.gz File in Linux

You can notice in the above image that the archive files are extracted in the same working directory. This compression is lossless – that means no data is lost during the compression process, and the original files can be fully restored upon extraction. You can also add the verbose output option (-v) to provide detailed listings, including dates, securities/permissions, and more.

This allows you to create bzip2-compressed files, often named .tar.bz2, .tar.bz, or .tbz files. To do so, just replace the -z for gzip in the commands here with a -j for bzip2. You can create your own compressed .tar files using compression utilities such as gzip. Gzip is one of the most popular and available options, especially since it comes built in to most Linux distributions and macOS. 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.

It offers AES-256 encryption to protect sensitive data within archives. Users can utilize the 7-zip command-line interface for automated & scripted extraction tasks. When you extract files from a .tar.gz archive, the checksum is automatically verified to detect & handle any potential data corruption. Since .tar.gz compresses multiple files all at once, it can take advantage of similarities between individual files to save on space. Generally speaking, a collection of files archived and compressed as a .tar.gz are more space-efficient (i.e., smaller) than the same collection compressed as a .zip.

You can review the contents of a tar file before you extract it by using the -t (list) option. It is usually convenient to pipe the output through the less command. List the files in the directory with ls and you’ll see that a directory has been created called Ukulele Songs. It was contained in the tar file, and was extracted along with the files.

how to extract tar.gz

Some of the most popular archive managers for Linux are File Roller, Ark, Xarchiver, and PeaZip. They offer more features and options best mining gpu 2020 than the file managers, such as creating, modifying, encrypting, and splitting archives. You can install them from your distribution’s package manager or software center. You can also extract only specific files or directories from a tar.gz archive, by providing their names after the archive name. You need to use the exact names and paths as listed by the tar -t command. The command will extract the files and directories in the current working directory, preserving the original permissions and ownership.

How to Extract or Unzip tar GZ File in Linux using Command Line

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

Is .gz a .tar file?

  1. As a result, one isn’t necessarily better than the other — it’s all a matter of application.
  2. As a result, we recommend sticking to free (but trustworthy) tools or simply using the command line.
  3. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004.
  4. However, there are some pretty major differences when it comes to accessing data within the files and the compression efficiency.

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.

A tar.gz file is a compressed archive format commonly used in Linux systems to combine multiple files and directories into a single file while reducing their size. It combines the tar utility for archiving and the gzip utility for compression. Knowing how to extract or unzip a tar.gz file allows users to access and manipulate the archives’ contents efficiently. If you’re using a graphical Linux desktop, you could also use the file-compression utility or file manager included with your desktop to create or extract .tar files. On Windows, you can extract and create .tar archives with the free 7-Zip utility. The .tar portion of the file extension stands for tape archive, and is the reason that both of these file types are called tar files.

Tar files date all the way back to 1979 when the tar command was created to allow system administrators to archive files onto tape. Forty years later we are still using the tar command to extract tar files on to our hard drives. WinRAR is a popular file compression & archive utility software. 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. Where .zip files consist of many individually compressed files, .tar files are compressed as a single package, leaving its files uncompressed.

You can use the official GNU gzip utility to extract the content of the compressed archive file. If the file you’re looking at is a TAR.GZ, using either tar or 7-Zip to extract the file will be a much simpler choice. The collective -xvzf flag stands for Extract, Verbose, gzip, and Filename respectively.

how to extract tar.gz

This specifies you want to extract an archive instead of create one. Just list as many directories or files as you want to back up. Once you’ve selected the right file, you’ll see „7-Zip File Manager” show up in the select app dialog. If you want 7-Zip to always handle tar.gz files in the future, you’re going to want to select the „Always” button at the bottom of the dialog. Tar.gz has become the standard format used for distributing Linux and open source software since it’s easy to extract on basically any platform that isn’t Windows. Looking in our Documents/Songs directory we’ll see the Guitar Songs directory has been created.

Oreon: A Fresh AlmaLinux-Based Distro Designed for Desktop Users

We can see that the Ukulele Songs directory contains directories called Random Songs, Ramones and Possibles. You may also be interested in learning about the best WinZip alternatives to compress files. Then we’ll jump into the step-by-step process of unzipping on both Linux and Windows platforms.

It can create a .tar archive and then compress it with gzip or bzip2 compression in a single command. That’s why the resulting file is a .tar.gz file or .tar.bz2 file. 7-Zip is a free and open-source tool with high compression ratios & supports a wide range of archive formats.

However, there are also many third-party tools you can install for a more user-friendly experience. 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. Where most operating systems make it easy to extract and create .zip files, the same can’t really be said for .tar files — at least not in ways that are easy to notice. If you want to see the progress of the extraction, you can use the -v option, which makes the tar command more verbose and prints the names of the files being extracted. If you don’t want the directory structure in the tar file to be recreated on your hard drive, use the –strip-components option.