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.
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.
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 bank accounts that let you draw in opposition to uncleared cheques 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.
How to Extract or Unzip tar GZ File in Linux using Command Line
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.
How can I unzip a .tar.gz in one step (using 7-Zip)?
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.
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 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.
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.
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.
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.
Troubleshooting Common Errors
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.
- The most often used algorithm for compressing tar files is Gzip.
- Note that this command will throw an error unless you specify the exact filename listed in the .tar file.
- If you want to see the progress of the extraction, you can use the -v option, which makes the tar command more verbose and prints the names of the files being extracted.
How to Unzip .tar.gz in Linux using tar
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.
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.