how to extract a tar.gz

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

how to extract a tar.gz

How to install Node.js and npm on Windows, macOS, and Linux

If you don’t want the directory structure in the tar file to be recreated on your hard drive, use the –strip-components option. The –strip-components option requires a numerical parameter. The number represents how many levels of directories to ignore. Files from the ignored directories are still extracted, but the directory structure is not replicated on your hard drive. So far we’ve just taken a leap of faith and extracted the files sight unseen. You can review the contents of a tar file before you extract it by using the -t (list) option.

  1. Any remotely modern version of tar should auto-detect that the archive is gzipped, and add “z” for you.
  2. Some common examples include .tar.bz2 (bzip2), .tar.br (Brotli), and .tar.zst (zstd), among many others.
  3. You can review the contents of a tar file before you extract it by using the -t (list) option.
  4. Ubuntu is a Southern African philosophy and term originating from South Africa and Zimbabwe.
  5. Otherwise, keep reading to learn how to unzip .tar.gz files in Linux, macOS, and Windows.

As a result, one isn’t necessarily better than the other — it’s all a matter of application. 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. The collective -xvzf flag stands for Extract, Verbose, gzip, and Filename respectively. Anything that follows the -f option is treated as the input file. Note that if you are working with TAR files, you can remove the -z flag from the commands. The tar command can extract the resulting erp software development for businesses archives, too.

How to Extract tar.gz File in Linux by Using the Command Line

Though we mostly focus on asp net mvc developer job description template software development .tar.gz files, check out the end of the article for some quick tips on extracting .tar files in other formats. Most of the time, you will get your hands on a compressed package that needs extracting. On Linux, there are multiple ways to unzip compressed archives.

How to Unzip or Extract TAR and TAR.GZ

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. Note that this command will throw an error unless you specify the exact filename listed in the .tar file. As we cover more in the next section, you can verify file names by listing contents with the tar -tf filename.tar.gz command. Compressing and extracting these files, however, isn’t always intuitive.

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. Use the –exclude flag to specify the about bdswiss review 2018 names of the files that you don’t want to extract. Creating archives is an important step when you’re backing up your Linux file system.

What’s the difference between .tar and .tar.gz files?

Decompressing TAR and TAR.GZ files is only a matter of few clicks using the GUI. Similarly, you can unzip specific directories from the archive as well. It’s the same as the archive creation command we used above, except the -x switch replaces the -c switch. This specifies you want to extract an archive instead of create one. To extract a single file, provide the path and the name of the file. As the files are extracted, they are listed in the terminal window.

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. Some third-party tools also offer extended flexibility for converting between file types‌, saving more time if you want to change between compression formats. You can easily unzip the resulting .tar.gz file with the decompress (-d) option.