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. By default, tar extracts the archive contents in the current working directory.
On Linux, there are multiple ways to unzip compressed archives. 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.
It contains compiled binaries, libraries, configuration files, and metadata required to install and manage software on a Ubuntu system. Perhaps you might also be interested in learning how to unzip files in Linux. You can notice in the above image that the archive files are extracted in the same working directory. 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. In this example, the user tried to extract the file titled “FILE” from filename.tar.gz.
Using the command line (cmd)
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. 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. The most common and widely supported method is to use the tar command, which can handle various compression formats, including gzip. Before extracting a tar.gz file, you may want to see what files and directories it contains.
This means it takes all the specified files and puts them together into one container. Looking in our Documents/Songs directory we’ll see the Guitar Songs directory has been created. I am using 7zip v19.00, just right click and choose extract here will do the work. 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.
Some third-party tools also offer extended flexibility for converting between file types, saving more time if you want to change between compression formats. Compressing and extracting these files, however, isn’t always intuitive. This article provides detailed guides to unzip .tar.gz files in Linux and Windows, as well as a few helpful tips and tricks. After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools. The command extracts files to a new directory called example1, which is located in the current directory.
List the Contents of a tar, tar.gz, tar.bz2 Files
Locate the compressed archive file and right-click on it to bring up the menu. The aforementioned command will extract the archive.tar.gz file to the /Downloads folder. You can easily extract .tar.gz files using third-party tools like 7 zip and Winrar on the Windows system. To extract a single file, provide the path and the name of the file. The -p (parents) option causes mkdir to create any parent directories that are required, ensuring the target directory is created. As the files are extracted, they are listed in the terminal window.
Simply add a space-separated list of the files you want to extract. 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.
- On the other hand, Windows users can rely on third-party file archiver tools like 7-zip or WinRAR to effortlessly extract files.
- This means it takes all the specified files and puts them together into one container.
- So far we’ve just taken a leap of faith and extracted the files sight unseen.
- In this article, you learned how to extract or unzip tar.gz files in Linux using the tar command and other tools.
- To do that, you can use the tar command with the -t option, which lists the contents of an archive without extracting it.
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. Whether you prefer command-line tools or graphical file archivers, the extraction process is pretty how to conduct an efficient payroll audit simple. It also integrates with the Windows Explorer context menu, which enables users to create and extract archives directly from the right-click menu. When the archive is extracted, these attributes are restored. This compression is lossless – that means no data is lost during the compression process, and the original files can be fully restored upon extraction.
current community
But it does not compress the data, which results in a larger file size compared to compressed formats. One file is called ukulele_songs.tar.gz , the other is called guitar_songs.tar.bz2 . Starting from Windows 10 build 17063, tar and curl are supported, therefore it is possible to unzip a .tar.gz file in one step by using tar command, as below. You can open most .tar.gz files using the tar command built in to Linux, macOS, and Windows 10.
tar: Archive is compressed. Use -z option
The -v option makes the tar command more verbose and prints the details of each file, such as permissions, owner, size, and modification date. If you only want to see the file names, you can omit the -v option. The following article will help you to extract (unpack) and uncompress (untar) – tar, tar.gz and tar.bz2 files from the Linux command line.
The -C option is used to specify a different directory other than the current working directory. The name “Tar” stands for “Tape Archiver” because it was used to place data on storage tapes when tar was invented. The tar program takes one or more files and “wraps” them into a self-contained file. Similarly, you can unzip specific directories from the archive as well.
Online Tools
They were officially introduced in Ubuntu 16.04 LTS, released in April 2016. Ubuntu versions are usually named using an alliterative adjective and an animal name, both starting with the same letter. Most Linux distributions come with the tar command pre-installed by default. Use the –exclude flag to specify the names of the files that you don’t want to extract.
See the help file (7-zip.chm) in the install directory for more info on the command line commands and switches. You can also add the verbose output option (-v) to provide detailed listings, including dates, securities/permissions, and more. Any remotely modern version of tar should auto-detect that the archive is gzipped, and add «z» for you.