You can easily extract .tar.gz files using third-party tools like 7 zip and Winrar on the Windows system. You can notice in the above image that the archive files are extracted in the same working directory. But it does not compress the data, which results in a larger file size compared to compressed formats. 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. You can easily unzip the resulting .tar.gz file with the decompress (-d) option.
- Now the file “four” is extracted to a new directory called “bar.” If “bar” already exists, then “four” is placed inside the existing directory.
- You can easily extract .tar.gz files using third-party tools like 7 zip and Winrar on the Windows system.
- Locate the compressed archive file and right-click on it to bring up the menu.
- 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.
- Compressing and extracting these files, however, isn’t always intuitive.
However, there are also many third-party tools you can install for a more user-friendly experience. 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. 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. Most file managers, such as Nautilus, Dolphin, or Thunar, support extracting tar.gz files by right-clicking on the file and choosing the Extract option from the context menu.
Extract Files from a .tar.gz via GUI
This is good and pretty comprehensive, Seth.One thing to point out is that, since .jpg and .png files are already compressed, you won’t get much compression with gzip. The command includes a large number of additional options, so we can’t possibly list them all here. Run the info tar command at the shell to view the tar command’s detailed information page. Gzip is faster, but it generally compresses a bit less, so you get a somewhat larger file. Bzip2 is slower, but it compresses a bit more, so you get a somewhat smaller file.
Thankfully, unless you’re somehow missing your tar or gzip utility, most common errors are very easy to fix. It’s often useful to list the contents of a .tar.gz file without having to unzip the entire archive. 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. As a result, one isn’t necessarily better than the other — it’s all a matter of application. Some of the most popular archive managers for Linux are File Roller, Ark, Xarchiver, and PeaZip.
As a result, it has become a common file extension for many open-source software packages and other resources. To extract a tar.gz file using the tar command, you need to use the -x option, which tells tar to extract the files from the archive. 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. 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.
Exclude Directories and Files
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.
You’ll want to replace “tarfile” with the path to the tar.gz file that you’re trying to extract. For a more detailed explanation on how the tar command works, be sure to read our guide to compressing and extracting files in the Linux Terminal. The tar command is extremely powerful, and you can do things like list or search for files in a tar archive, or extract a single file. And now you can use the 7-Zip File Manager to open, view, or extract files from tar.gz and other archives. If you want a specific file, you can drill down into the folder, or you can simply click the “Extract” button and choose a location to put all the 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.
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. Once you’re comfortable with the basics, it’s useful to explore other features.
Gzip is also more common, with some stripped-down Linux systems including gzip support by default, but not bzip2 support. In general, though, gzip and bzip2 are practically the same thing, and both will work similarly. Use the following command to compress an entire directory or a single file on Linux. It’ll also compress every other directory inside a directory you specify — in other words, it works recursively. The aforementioned command will extract the archive.tar.gz file to the /Downloads folder. But with .zip being the easier of the two to use, why use .tar in the first place?
How to “Unzip” or Extract a Tar.gz File on Windows
You can also select the files and directories you want to extract and the destination directory where you want to extract them. 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 GNU tar command included with Linux distributions has integrated compression.
Most of the time, you will get your hands on a compressed package that needs extracting. Again, the above command extracts 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.
Replies to “Untar Tar.gz – Linux Tar Command – HowTo: Extract Tar File”
After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools. A user-friendly way to extract files from a .tar.gz archive is via a Graphical User Interface (GUI). In this guide, you will learn how to extract or unzip .tar.gz files in Linux. 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 if you try to decompress a file without specifying a decompression utility, specifically -z for gzip.
In some cases, you may wish to compress an entire directory, but not include certain files and directories. You can do so by appending an –exclude switch for each directory or file you want to exclude. It also integrates with the Windows Explorer context menu, which enables users to create and extract archives directly from the right-click menu.
For TAR.GZ files, you will have to unzip the compressed archive to TAR, and then further extract the TAR file using 7-Zip. The first part of the command writes the archive.tar file to the standard output. The second command reads the archive.tar file from the standard input and compresses it accordingly.
Simply add a space-separated list of the files you want to extract. This command extracts (-x) the file (-f) specified (in this case, filename.tar.gz) to the current cryptopia estimates 9% of total assets stolen during january hack directory. Note that this command also works with other common compression formats such as .tar.bz2.