Most Linux distributions ship with a preinstalled archive manager. Decompressing TAR and TAR.GZ files is only a matter of few clicks using the GUI. The aforementioned command will extract the archive.tar.gz file to the /Downloads folder. It also integrates with the Windows Explorer context menu, which enables users to create and extract archives directly from the right-click menu. You can easily extract .tar.gz files using third-party tools like 7 zip and Winrar on the Windows system.
How to Extract a tar.gz File
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.
Otherwise, keep reading to learn how to unzip .tar.gz files in Linux, macOS, and Windows. Where possible, leverage tar+gzip for archiving on Linux and Unix-like platforms. Resort to zip where compatibility with other operating systems is paramount. This pipelines a tarball through pigz with 8 worker threads fully utilizing CPU resources for significantly faster compression speed.
Is .tar.gz same as .zip?
In Linux, users have multiple ways to extract .tar.gz files – through the terminal and graphical file archivers. To unzip the .tar.gz files, you’ll need to use specific commands and tools depending on your operating system. Let’s explore the extraction process for both Linux & Windows platforms. Like the tar utility, gzip also allows you to zip and unzip multiple files or entire directories at a time. Note that this command will throw an error unless you specify the exact filename listed in the .tar file.
Note that this command also works with other common compression formats such as .tar.bz2. By specifying the .gz extension, the tarball contents are compressed by gzip providing greatly enhanced storage efficiency. 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. To do credit notes have an expiry date do this we’ll use 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.
- Ubuntu LTS (Long-Term Support) versions, known for their stability and extended support periods, are typically released every two years in April.
- Notice that we don’t need to use the -z option to list the files.
- The first part of the command writes the archive.tar file to the standard output.
- There are several ways to extract or unzip a tar.gz file in Linux, depending on the tool you have available or prefer to use.
- You can also add the verbose output option (-v) to provide detailed listings, including dates, securities/permissions, and more.
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. WinRAR is a popular file compression & archive utility software.
Recursively Archiving Directory Trees
Perhaps you might also be interested in learning how to unzip files in Linux. File compression is a great way to save storage on a computer. If you’re familiar with packages in Linux, you may have come across a TAR or a TAR.GZ file. 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.
.tar.gz Files
We can see that the Ukulele Songs directory contains directories called Random Songs, Ramones and Possibles. Ubuntu Core is a minimalistic and immutable version explicitly designed for the Internet of Things (IoT) and embedded systems. 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.
You also need to use the -z option to indicate that the archive is compressed with gzip, and the -f option to specify the file name. Learn how to extract or unzip tar.gz files in Linux using the tar command and other tools. Find out how to list, extract, and create tar.gz archives. 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. This command extracts (-x) the file (-f) specified (in this case, filename.tar.gz) to the current directory.
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. Most of the time, you will get your hands on a compressed package that needs extracting.
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. A GZ file is nothing but a file compressed using the gzip algorithm. 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.
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. By default, tar extracts the archive contents in the current working directory. If you want to extract the files to a different directory, you can use the -C option, which tells tar to change the directory before extracting the files. You need to specify the path to the directory where you want to extract the files after the -C option. Before extracting a tar.gz file, you may want to see what files and directories it contains.
The collective -xvzf flag stands for Extract, Verbose, gzip, and Filename respectively. Anything that follows the -f option is treated as the input file. Note that if you are working with TAR files, you can remove the -z flag from the commands. On the other hand, Windows users can rely on third-party file archiver tools like 7-zip or WinRAR to effortlessly extract files. After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools.
As a result, we recommend sticking to free (but trustworthy) tools or simply using the command line. To access the Windows command line, search for “command prompt” or “cmd” in the search bar. Right-click the first result and select the “Run as administrator” option. Ubuntu versions are usually named using an alliterative adjective and an animal name, both starting with the same letter.
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. 7-Zip is a free and open-source tool with high compression ratios & supports a wide range of archive formats. 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. The tar command also provides support for extracting only specific files or directories from a .tar.gz file.