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

how to open tar gz

Ubuntu versions are usually named using an alliterative adjective and an animal name, both starting with the same letter. 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. 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. An advantage of this method is that it can be used on any operating system, whether Windows or Mac, without worrying about native support.

  1. Mac users can also use this command to extract their tar.gz files, though they also have access to a GUI-based method we will discuss in the next section.
  2. Some third-party tools also offer extended flexibility for converting between file types‌, saving more time if you want to change between compression formats.
  3. By convention, the name of a tar archive compressed with gzip becomes .tar.gz or .tgz.
  4. Though both .zip and .tar.gz archive and compress files, they do so in different ways.

This error usually occurs when a .tar has been saved as a .gz despite having never been compressed using the gzip utility. 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. Mac’s native archive utility supports the file format as well, which means you can just double-click on the tar.gz file in question to extract it.

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. This example uses example1.tar.gz in the Home directory.

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

Thankfully, unless you’re somehow missing your tar or gzip utility, most common errors are very easy to fix. 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. Instead of downloading a specific application to your computer or leveraging its built-in abilities, you can extract your tar.gz archive using an online app.

Many are also available for Linux and macOS. Note that this command will throw an error unless you specify the exact filename listed in the .tar file. As we’ll cover more in the next section, you can verify file names by listing contents with the tar -tf filename.tar.gz command. 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.

This command will extract (-x) the file (-f) specified (in this case, filename.tar.gz) to the current directory. Note that this command also works with other common compression formats such as .tar.bz2. Though gzip is the most common compression utility, it’s not the only one.

Open TGZ Files Using the Terminal in Linux

Gzip (denoted by a .gz file extension) is a compressed file format used to archive data to take up smaller space. Gzip uses the same compression algorithm as the more commonly known zip but can only be used on a single file. In short, Gzip compresses all the individual files and tar packages them in a single 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.

how to open tar gz

Indeed, sometimes the resulting tarball can be of greater size due to padding. 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. It’s often useful to list the contents of a .tar.gz file without having to unzip the entire archive. The -list (-t) option will output a list of filenames. Again, the above commands will extract to the current working directory by default.

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. If that’s not entirely clear, don’t worry. As a result, one isn’t necessarily better than the other — it’s all a matter of application. So, a tar.gz file is a tarball compressed using gzip.

Therefore, knowing how to open or untar tar.gz files is very useful. The command extracts files to a new directory called example1, which is located in the current directory. Any remotely modern version of tar should auto-detect that the archive is gzipped, and add “z” for you. You can also use –wildcards to extract all files with a certain extension or name. Otherwise, keep reading to learn how to unzip .tar.gz files in Linux, macOS, and Windows.

If you’re not comfortable with the terminal or command line, third-party tools such as 7-Zip offer a more user-friendly alternative. In this example, the user tried to extract the file titled “FILE” from filename.tar.gz. However, tar was unable to find FILE within .tar.gz, meaning that the user either misspelled the name or that the file simply doesn’t exist in filename.tar.gz. Another common cause of errors is case sensitivity, where Linux treats “FILE” and “file” as two separate entities. Some third-party tools also offer extended flexibility for converting between file types‌, saving more time if you want to change between compression formats.

Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004. 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. Most Linux distributions come with the tar command pre-installed by default.

Only Extract Specific Files or Directories From .tar.gz in Linux

Now you know how to untar a tar.gz file in Linux. Perhaps you might also be interested in learning how to unzip files in Linux. Sometimes you need to view the content of a tar file as it collects many files and ensures if a specific file is present. After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools.

This error occurs when trying to extract specific files or directories from a .tar.gz file using tar. In most platforms, the chances are that you already possess the right application to extract and open TGZ files. Linux, of course, can open these files natively, while most Mac and Windows computers have software like the Unarchiver or 7-Zip installed on them. Ubuntu Core is a minimalistic and immutable version explicitly designed for the Internet of Things (IoT) and embedded systems. Many of the downloadable Linux/Unix files found on the internet are compressed using a tar.gz format.

While every tar.gz file is a .tar archive, not every .gz is a .tar file. The .gz extension represents the gzip compression format, which can be applied to almost any file format to compress data and save space. The most often used algorithm for compressing tar files is Gzip. By convention, the name of a tar archive compressed with gzip becomes .tar.gz or .tgz.

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

In this guide, you will learn how to extract or unzip .tar.gz files in Linux. Note the lack of hyphen for the command flags. This is because most versions of tar allow both gnu and bsd style options (simplistically, gnu requires a hyphen, bsd doesn’t).

Comments are closed, but trackbacks and pingbacks are open.