How to Compress and Extract Files Using the tar Command on Linux

how to extract a tar.gz

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.

Unzip .tar.gz from stdin in Linux

This article provides detailed guides to unzip .tar.gz files in Linux and Windows, as well as a few helpful tips and tricks. Sometimes you need to view the content of a tar file as it collects many files and ensures if a specific file is present. You can choose which files to extract from the archive. To do so, simply pass the file names with the default command.

  1. While slightly different, they are quite lightweight and offer a much simpler alternative to using the command line.
  2. As a result, it has become a common file extension for many open-source software packages and other resources.
  3. Simply add a space-separated list of the files you want to extract.
  4. People new to the .tar format usually equate it to a .zip archive, but a tar archive is not compressed.
  5. If you’re using a graphical Linux desktop, you could also use the file-compression utility or file manager included with your desktop to create or extract .tar files.

Exclude Directories and Files

In general, though, gzip and bzip2 are practically the same thing, and both will work similarly. Use the following command to compress an entire directory or a single file on Linux. It’ll also compress every other directory inside a directory you specify — in other words, it works recursively. To extract all the files from a directory within a tar file use the following command. Note that the path is wrapped in quotation marks because there are spaces in the path. Notice that we don’t need to use the -z option to list the files.

The easiest way to open a tar.gz file on Windows is to install an excellent free utility called 7-Zip, which can handle tar.gz and just about any other file format. We’ve been recommending this app for years, and it’s one of the first things that we install whenever reinstalling Windows. In this guide, you will learn how to extract or unzip .tar.gz files in Linux. But with .zip being the easier of the two to use, why use .tar in the first place?

how to extract a tar.gz

How to Unzip .tar.gz in Linux using tar

This command extracts (-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. Of course, that’s not to say .tar files are some kind of “lesser” format than .zip. Rather, they both accomplish the same task (file compression) in the same way. People new to the .tar buy bitcoin litecoin and ethereum 2021 format usually equate it to a .zip archive, but a tar archive is not compressed.

Therefore, knowing how to open or untar tar.gz files is very useful. The aforementioned command will extract the archive.tar.gz file to the /Downloads folder. The -p (parents) option causes mkdir to create any parent directories that are required, ensuring the target directory is created. After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools.

This example uses example1.tar.gz in the Home directory. The ethereum wakes up as chinese institution hops on the crypto bus output shows a newly created archive example1.tar.gz. Similar to the previous error, this error occurs when an archive was saved as a .tar despite not being a .tar archive.

You’ll encounter them frequently while using a Linux distribution like Ubuntu or even while using the terminal on macOS. Here’s how to extract — or untar — the contents of a tar file, also known as a tarball. Since .tar.gz compresses multiple files all at once, it can take advantage of similarities between individual files to save on space. Generally speaking, a collection of files archived and compressed as a .tar.gz are more space-efficient (i.e., smaller) than the same collection compressed as a .zip. 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 6 basic steps of the software development process 2022 updated file path when using the tar utility.


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

vulkan vegas, vulkan casino, vulkan vegas casino, vulkan vegas login, vulkan vegas deutschland, vulkan vegas bonus code, vulkan vegas promo code, vulkan vegas österreich, vulkan vegas erfahrung, vulkan vegas bonus code 50 freispiele, 1win, 1 win, 1win az, 1win giriş, 1win aviator, 1 win az, 1win azerbaycan, 1win yukle, pin up, pinup, pin up casino, pin-up, pinup az, pin-up casino giriş, pin-up casino, pin-up kazino, pin up azerbaycan, pin up az, mostbet, mostbet uz, mostbet skachat, mostbet apk, mostbet uz kirish, mostbet online, mostbet casino, mostbet o'ynash, mostbet uz online, most bet, mostbet, mostbet az, mostbet giriş, mostbet yukle, mostbet indir, mostbet aviator, mostbet casino, mostbet azerbaycan, mostbet yükle, mostbet qeydiyyat