Extracting a tar file in Linux is very straightforward. You can use the same command to extract almost any kind of tar file: .tar.gz, .tar.bz2, and .tar.xz.
How To Extract A Tar File In Linux
Let’s assume that you have a tar file named example.tar.gz.
To extract the contents of this file, all you would need to do is:
tar xfv example.tar.gz
Similarly, if we had a file named example2.tar.bz2, we could extract its contents with:
tar xfv example2.tar.bz2
If we had a file named example3.tar.xz, we could extract its contents with:
tar xfv example2.tar.bz2
Want to learn how to compress a file or folder in Linux? Then read our article titled How To Compress A File or Folder With Tar In Linux
What did you think of this article? Do you have anything to add? Let’s discuss it in the comments below.