How to Extract or Unzip tar.gz Files in Linux
Like many archive and compression formats, .tar.gz is an effective way to save storage space and make it easier to send large amounts of data. If you plan to distribute and store .tar.gz files on your website, Kinsta’s managed hosting services can help make the most of your space. When you extract files from a .tar.gz archive, the checksum is automatically verified how to program a cryptocurrency exchange to detect & handle any potential data corruption. This command will extract (-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. Most Linux distributions and macOS include built-in tools for zipping and unzipping .tar and .tar.gz files.
- Like the tar utility, gzip also allows you to zip and unzip multiple files or entire directories at a time.
- It is assumed that you are extracting a tarball created on another system.
- You’ll probably have to install the “other” tar (whatever that may be on your system) manually.
- If you’re not comfortable with the terminal or command line, third-party tools such as 7-Zip offer a more user-friendly alternative.
- Uncover your website’s performance bottlenecks to deliver a better user experience.
Are you facing the issue of low memory error on your system while performing basic tasks on your Windows PC? This simplifies file management npm dependencies and devdependencies and reduces the risk of data loss during transfers. Uncover your website’s performance bottlenecks to deliver a better user experience.
Get started with a free trial of our Application Hosting or Database Hosting. For more information and to schedule a live demo, contact a hosting expert from Kinsta today. Pureinfotech is the best site to get Windows help – featuring friendly how-to guides on Windows 10, Windows 11, Xbox, and other things tech, news, deals, reviews, and more. 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.
In this example, the user tried to extract the file titled “FILE” from filename.tar.gz. However, tar was unable to find FILE within .tar.gz, meaning that the user either misspelled the name or that the file simply doesn’t kr1 plc checks out of golem and qtum with healthy profit exist in filename.tar.gz. Another common cause of errors is case sensitivity, where Linux treats “FILE” and “file” as two separate entities. If you want to keep the original file after compression, there are two options.
Connect and share knowledge within a single location that is structured and easy to search. This is not just about how to turn on and off sticky keys but a wholesome guide to using them for making a few things simple on a Windows PC. The two most important software used by small to medium organizations to run the IT infrastructure and operations efficiently are Windows Server and Office 365 (Microsoft 365).
Of course, that’s not to say .tar files are some kind of “lesser” format than .zip. Rather, they both accomplish the same task (file compression) in the same way. On the other hand, Windows users can rely on third-party file archiver tools like 7-zip or WinRAR to effortlessly extract files. Whether you prefer command-line tools or graphical file archivers, the extraction process is pretty simple. Note that this command will throw an error unless you specify the exact filename listed in the .tar file. As we’ll cover more in the next section, you can verify file names by listing contents with the tar -tf filename.tar.gz command.
Creating a tarball
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. 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. 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.
Extract Files to the Specific Directory
Users can utilize the 7-zip command-line interface for automated & scripted extraction tasks. 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. 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 will be more space-efficient (i.e., smaller) than the same collection compressed as a .zip.
List Contents of .tar.gz File in Linux
Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 14 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux.
This compression is lossless – that means no data is lost during the compression process, and the original files can be fully restored upon extraction. A user-friendly way to extract files from a .tar.gz archive is via a Graphical User Interface (GUI). 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. This error occurs when trying to extract specific files or directories from a .tar.gz file using tar. Some third-party tools also offer extended flexibility for converting between file types, saving more time if you want to change between compression formats.
Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. The tar format is just a format, and it’s an open format, so it can be created by more than just one tool.
However, there are also many third-party tools you can install for a more user-friendly experience. On Windows, the easiest way to handle .tar files is to install the LGPL open source 7-Zip utility. Its name implies it’s a zip utility, but it also works with tar archives, and even provides commands for the cmd command-line interface. It allows users to create, view, and extract files in various archive formats, including its native .RAR format as well as other common formats like .ZIP, .7z, ISO, .TAR, and more.
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. Given this structure, the site admin could extract your incoming archive directly to the server’s root directory. The tar utility autodetects the existence of /var/ as well as the subdirectories store, deals, and images, and distributes the files into the proper directories. Knowing how to unzip a .tar.gz file allows users to extract and access the archives’ contents efficiently.
While the tar utility is enough for most purposes, you’ll need the gzip utility to create .tar.gz files. Though gzip is the most common compression utility, it’s not the only one. 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. Technical details aside, all you need to remember is that .zip files are more accessible but less space-efficient, while .tar files are less accessible but more space-efficient.
While there are many tools to choose from, the most popular include 7-Zip and WinZip. While slightly different, they are quite lightweight and offer a much simpler alternative to using the command line. Once you’re comfortable with the basics, it’s useful to explore other features.
As we’ll see later, different compression utilities may require different methods for extracting and unzipping files. Though we’ll mostly focus on .tar.gz files, check out the end of the article for some quick tips on extracting .tar files in other formats. 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. While every tar.gz file is a .tar archive, not every .gz is a .tar file.