How To Extract and Unzip tar.gz Files for Linux & Windows

how to extract a tar.gz

This is because most versions of tar allow both gnu and bsd style options (simplistically, gnu requires a hyphen, bsd doesn’t). 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. See the help file (7-zip.chm) in the install directory for more info on the command line commands and switches. In this example, the user tried to extract the file titled “FILE” from filename.tar.gz.

By convention, the name of a tar archive compressed with gzip becomes .tar.gz or .tgz. 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.

how to extract a tar.gz

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. Many of the downloadable Linux/Unix files found on the internet are compressed using a tar.gz format. Therefore, knowing how to open or untar tar.gz files is very useful. Similar to the previous error, this error occurs when an archive was saved as a .tar despite not being a .tar archive. You can also use –wildcards to extract all files with a certain extension or name.

Extract Files from a .tar.gz via GUI

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. 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), (Brotli), and .tar.zst (zstd), among many others. As a result, one isn’t necessarily better than the other — it’s all a matter of application.

  1. Another common cause of errors is case sensitivity, where Linux treats “FILE” and “file” as two separate entities.
  2. Alternatively, you can also specify a source and destination file path when using the tar utility.
  3. The -list (-t) option will output a list of filenames.
  4. Where commands have little (if any) room for typos or omissions, many common errors are the result of small mistakes, misspellings, or incorrect formats.
  5. However, there are some pretty major differences when it comes to accessing data within the files and the compression efficiency.

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. From videos to entire software packages, many files are compressed and stored using the .tar.gz format.

tar: Unrecognized archive format

Though we’ll mostly focus on .tar.gz files, check out the end of the article for some quick tips on extracting .tar files in other formats. By default, tar extracts the archive contents in the current working directory. 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. While every tar.gz file is a .tar archive, not every .gz is a .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). A GUI is more suitable for beginners than a command-line tool. You can specify one or more files or directories to include in the archive.

List Contents of .tar.gz File in Linux

Right-click the first result and select the “Run as administrator” option. The output shows a newly created archive example1.tar.gz. If the directory does not exist, tar will create it automatically. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004.

If you specify a directory, tar will recursively archive all the files and subdirectories in that directory. Ubuntu LTS (Long-Term Support) versions, known for their stability and extended support periods, are typically released every two years in April. These are popular for organizations and users who require a reliable and well-supported Ubuntu operating system. Sometimes you need to view the content of a tar file as it collects many files and ensures if a specific file is present. But with .zip being the easier of the two to use, why use .tar in the first place? As we’ll see in the next section, .tar comes with a few extra features that make it the better compression format for certain files and applications.

Any remotely modern version of tar should auto-detect that the archive is gzipped, and add “z” for you. Snaps were developed by Canonical, the company behind Ubuntu, to package and distribute software focusing on security, sandboxing, and ease of installation and updates. They were officially introduced in Ubuntu 16.04 LTS, released in April 2016. Ubuntu Core is a minimalistic and immutable version explicitly designed for the Internet of Things (IoT) and embedded systems. The -C option is used to specify a different directory other than the current working directory.

What command do I need to unzip/extract a .tar.gz file?

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. 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. It’s often useful to list the contents of a .tar.gz file without having to unzip the entire archive.

The Ubuntu logo, often called the “Circle of Friends,” comprises three people holding hands. It signifies the strong sense of community and interconnectedness at the core of Ubuntu’s philosophy. Put your knowledge to the test in our lightning-fast Ubuntu quiz! Ten questions to challenge yourself to see if you’re a Linux legend or just a penguin in the making. For more information and to schedule a live demo, contact a hosting expert from Kinsta today. Once you choose the directory, click the Select button in the top right corner.

This example uses example1.tar.gz in the Home directory. Ubuntu versions are usually named using an alliterative adjective and an animal name, both starting with the same letter. Ubuntu is a Southern African philosophy and term originating from South Africa and Zimbabwe. I am using 7zip v19.00, just right click and choose extract here will do the work. Although 7zip issues warning, the result is fine for me. To access the Windows command line, search for “command prompt” or “cmd” in the search bar.

You can use the -C option to extract to a different directory (in this case, /home/user/files). 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. People new to the .tar format usually equate it to a .zip archive, but a tar archive is not compressed. Tar collected all the files into one package, but the files can be compressed with separate utilities. Since .tar.gz compresses multiple files all at once, it can take advantage of similarities between individual files to save on space.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart