Note that this command also works with other common compression formats such as .tar.bz2. 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.
- While the tar utility is enough for most purposes, you’ll need the gzip utility to create .tar.gz files.
- During this process, the compressed file is seamlessly replaced with its uncompressed version.
- Thankfully, you don’t need to be a 1960s computer technician to use and extract .tar files – nor do modern .tar files even have anything to do with old computers.
- Jean-loup Gailly and Mark Adler developed gzip for the GNU project as a replacement for compress.
- Being a Linux user, you might face a situation where you’ve compressed a file and you want to know the details about it.
- Ideally, you should be decompressing it before and then you might be able to get its details.
This guide covered various commands for decompressing files and directories using the “gunzip” utility that are compressed by the “gzip” command. 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.
The flag or option comes with a hyphen after the “gunzip” command. 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.
Most Linux distributions and macOS include built-in tools for zipping and unzipping .tar and .tar.gz files. While the tar utility is enough for most purposes, you’ll need the gzip utility to create .tar.gz files. 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.
What Are .tar and .tar.gz Files?
This will display comprehensive information about the “ubuntuMintFile” file. Once you choose the directory, click the Select button in the top right corner. This is simpler than you think, so without further ado, let’s get started.
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. Again, the above commands will extract to the current working directory by default. You can use the -C option to extract to a different directory (in this case, /home/user/files). 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. Sometimes, you may need to decompress a file while a decompressed file of the same name already exists in the directory.
If you’re working with similar file types, our how to open TGZ file guide should come in handy. There are other important tasks you’ll need to learn if you want to become a Linux pro, however. Be sure to check out our guide on searching for files in Linux, as well as how to change your password. The original file is deleted, leaving only the compressed version annual-profit.xlsx.gz. There are other options to choose from this context menu, but in the case at hand, none have anything to do with extraction, so we’ll ignore them. Being a Linux user, you might face a situation where you’ve compressed a file and you want to know the details about it.
Extract Files with gzip
Like the tar utility, gzip also allows you to zip and unzip multiple files or entire directories at a time. 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. Knowing how to unzip a .tar.gz file allows users to extract and access the archives’ contents efficiently. Note that this command will throw an error unless you specify the exact filename listed in the .tar file.
As we have seen over the course of this article, xz files are nothing special. Most of the newer graphical distros like Ubuntu and Linux Mint come with built in tools to decompress files using a GUI. The “gunzip” command provides a “-l” flag which displays the information about the compressed file without necessitating its decompression. This information the 10 best places to buy bitcoin in 2021 revealed might be the size of the original file, the size of a compressed file, the name of the actual file, and the ratio of compression. 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.
If you have an error which is not present in the article, or if you know a better solution, please help us to improve this guide. That being the case, we would like to recommend you try out WinZip, the world’s best file archiver and unzipper. However, while tools like 7-Zip are free, many more “robust” solutions are only available for a price after a trial period.
As a result, we recommend sticking to free (but trustworthy) tools or simply using the command line. 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’ve followed these steps, the file’s content should now be extracted in the location of your choosing.
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 dom vs shadow vs virtual dom all about dom by anil kumar medium of the article for some quick tips on extracting .tar files in other formats. The “gunzip” command is one of the best algorithms used by Linux enthusiasts for file decompression.
A GUI is more suitable for beginners than a command-line tool. Since GZ files are compressed formats, after all, it goes without saying that extracting them requires a utility that can perform this task. Likewise, you can even prefer speed over quality while uncompressing a file or directory. In this case, use the “-1” option followed by the filename that is to be decompressed. If there’s a compressed file you need to open, once again right-click that archive in Files.
How To Extract and Unzip .tar.gz Files (for Linux and Windows)
In other words, .zip files are a collection of compressed files, while .tar files are a compressed collection of files. If you have been on Linux for sometime you might have come across another file extension .tar.gz. This overcomes the big limitation of standard gz, and allows for compression of entire folders. It’s important to note, the gzip algorithm is designed to compress a single file. If you need to bundle multiple files together, or an entire directory structure, you’ll use both tar and gz.
How to List Contents of .tar.gz File in Linux
Worry not, in this article, we deep dive into the details of gz file and help you overcome your doubts about it. It is very easy to unzip a GZ file on Windows 10 using Command Prompt, also known as cmd. It is a built-in app which allows you to communicate with the OS through commands. This command will display the textual content of the file “ubuntuMintFile.gz”. Moving ahead, now we will discuss some examples of the gunzip command to understand its usage. If you would rather not work in the terminal, graphical desktop environments have what you need.
This error usually occurs when a .tar has been saved as a .gz despite having never been compressed using the gzip utility. Executing this command will effectively decompress the specified files, creating new decompressed versions while how to become a software engineer developer retaining the original compressed files intact. To confirm the change, display all the files in the current directory. This command will extract (-x) the file (-f) specified (in this case, filename.tar.gz) to the current directory.