How to Unzip a tar file in Linux

A tar.gz file comprises a number of compressed information to save lots of space for storing, in addition to bandwidth through the downloading course. The .tar file acts as a transportable container for different information and is usually referred to as a tarball. The .gz a part of the extension stands for gzip, a commonly-used compression utility.

A variety of the downloadable Linux or Unix information discovered on the web is compressed utilizing a tar or tar.gz compression format. So, understanding easy methods to open or untar these compressed information turns into crucial. In the next examples, we are going to clarify easy methods to untar each well-liked codecs and easy methods to extract the contents to a special listing.

Unzip a tar.gz File in Linux

1. Open a Linux terminal by ctrl+alt+t.
2. From the terminal, change the directory to where your .tar.gz file is located. Change the filename section with your document name.

cd /directory_path/files_name.tar.gz

3. To extract the contents of the tar.gz file to the current directory.

tar -zxvf files_name.tar.gz

4. To extract the contents of the tar.gz file to the other specific directory.

tar -C /myfolder -zxvf files_name.tar.gz

Unzip a tar File in Linux

1. From the terminal, change to the directory where your .tar file has been located.
2. To extract or untar the file to the current directory. Change the filename section with your document name.

3. To extract the contents of the tar file to the current directory.

tar -xvf files_name.tar

4. To extract the contents of the tar file to the other specific directory.

tar -C /myfolder -xvf files_name.tar

Command

Unzip a tar file in Linux

As you can see in the above command, we have used xvzf because these have specific meanings, and they are:

  • x: This command instructs to extract the files from a particular zip file.
  • v: This command stands for verbose that works to list out the files
  • Z: This command instructs to decompress the files.
  • F: This command instructs the filename on which you want to work.

Conclusion

This is how one can simply extract and open tar recordsdata in Linux with no errors. As we have now talked about earlier, tar recordsdata retailer the recordsdata in a compressed method, so it’s important to extract these recordsdata for utilizing them.