How to Extract or Unzip tar.gz Files in Linux

how to decompress tar.gz

After reading this post thoroughly you are now ready to unzip any tar.gz file on any platform whether it is Linux, macOS, or Windows using the command line easily. 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. A “.tar” file is a collection of files compressed into a single file or archive.

  1. A “.tar” file is a collection of files compressed into a single file or archive.
  2. You can easily extract .tar.gz files using third-party tools like 7 zip and Winrar on the Windows system.
  3. The tar command also provides support for extracting only specific files or directories from a .tar.gz file.
  4. While slightly different, they are quite lightweight and offer a much simpler alternative to using the command line.
  5. From videos to entire software packages, many files are compressed and stored using the .tar.gz format.

If you want to keep the original file after compression, there are two options. The first is the -k option, and the other uses the -c option to output the compressed file to a different file, preserving the original. It also integrates with the Windows Explorer context menu, which enables https://www.cryptominer.services/ users to create and extract archives directly from the right-click menu. 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.

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. This ultimate guy helps you How to unzip or extract .tar.gz file using the tar as well as gzip utility tool and also troubleshoot errors while using them.

How to Extract/Unzip .tar.gz Files? [Linux & Windows]

Note that this command also works with other common compression formats such as .tar.bz2. From videos to entire software packages, many files are compressed and stored using the .tar.gz format. While extracting a .tar.gz file isn’t quite as easy as unzipping a .zip, it’s still pretty straightforward. 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.

how to decompress tar.gz

After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools. In this guide, you will learn how to extract or unzip .tar.gz files in Linux. You can open most .tar.gz files using the tar command built in to Linux, macOS, and Windows 10. If you’re not comfortable with the terminal or command line, third-party tools such as 7-Zip offer a more user-friendly alternative.

When you extract files from a .tar.gz archive, the checksum is automatically verified to detect & handle any potential data corruption. 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.

Where commands have little (if any) room for typos or omissions, many common errors are the result of small mistakes, misspellings, or incorrect formats. Thankfully, unless you’re somehow missing your tar or gzip utility, most common errors are very easy to fix. 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. Since .tar.gz compresses multiple files all at once, it can take advantage of similarities between individual files to save on space.

List Contents of .tar.gz File in Linux

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. Unlike Windows’ convenient graphical user interface https://www.cryptonews.wiki/ (GUI) for unzipping .zip files, you’ll need to use the tar utility through the command line. However, there are also many third-party tools you can install for a more user-friendly experience. This command will extract (-x) the file (-f) specified (in this case, filename.tar.gz) to the current directory.

Unlike the .tar file, the .zip doesn’t require any compression initially and compresses each file within the collection. The tar command also provides support for extracting only specific files or directories from a .tar.gz file. Simply add a space-separated list of the files you want to extract. As a result, one isn’t necessarily better than the other — it’s all a matter of application. The extraction method is precisely the same for tar files that have compression, such as.tar.gz,.tar.bz2, and others. 7-Zip is a free and open-source tool with high compression ratios & supports a wide range of archive formats.

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. It’s often useful to list the contents of a .tar.gz file without having to unzip the entire archive. Again, the above commands will extract to the current working directory by default.

gzip: stdin: not in gzip format

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. 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. 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.

Any remotely modern version of tar should auto-detect that the archive is gzipped, and add “z” for you. This is because most versions of tar allow both gnu and bsd style options (simplistically, gnu requires a hyphen, bsd doesn’t). That means users can download and use it for free during a trial period. Also, its trial version does not have time limitations, and https://www.crypto-trading.info/ users can still use it even after the trial period has expired, with occasional reminders to purchase the license. These files can be used in incremental backup strategies – where only new or modified files are added to the archive. Gzip compression reduces the overall file size, which makes it more efficient for distribution, backup, and storage purposes.

You can also use –wildcards to extract all files with a certain extension or name. You may also be interested in learning about the best WinZip alternatives to compress files. All you have to just add a space between the files you want to extract. For your information, many Linux distributions such as Ubuntu and MacOS come up with inbuilt tools for Compressing and Extracting .tar and .tar.gz files. Similar to the previous error, this error occurs when an archive was saved as a .tar despite not being a .tar archive.

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. In other words, .zip files are a collection of compressed files, while .tar files are a compressed collection of files. While every tar.gz file is a .tar archive, not every .gz is a .tar file.

Some third-party tools also offer extended flexibility for converting between file types‌, saving more time if you want to change between compression formats. This compression is lossless – that means no data is lost during the compression process, and the original files can be fully restored upon extraction. You have to mention a particular decompression option such as gzip (-z) in the above tar command, i.e. “Sudo tar -xz” on the far right.

Leave a comment

Your email address will not be published.