Subscribe to our RSS feed to get alerted every time SUBSCRIBE!

How to Extract tar.gz / tar.bz2 / tar.xz Files on Linux

The TAR command is create in Linux for archiving backup data to a Tape drive. The commands has large amount of advantage. The Linux system admins is using for Backup and restoring purposes. The tarballs are most popular method to archiving data into tar files including various TAR extensions. It is developed to achieve data with robust tar ball files. This is most widely used Linux commands for most probably used for the backup. When any backup is archiving with this method then question arises here how to exact the tar balls. This tutorial show how extract those tar ball files.

Syntax of command

First of all These are given syntax is recommend only for tar command.

tar.gz

 tar -recommended-options filename.tar.gz -optional-options

tar.bz2

 tar -recommended-options filename.tar.bz2 -optional-options

tar.xz

 tar -recommended-options filename.tar.xz -optional-options

Options

Secondly the Recommended Options are:

  • x : Extract
  • v : Verbose Mode
  • f : File Name
  • z : Decompress for tar.gz file only
  • j : Decompress for tar.bz2 file only
  • J : Decompress for tar.xz file only

Finally the Optional Options are

  • C : Followed by the Path of Destination Directory

Extract Files in Same Current Directory

Secondly the file extraction process should followed by the same directory.

tar.gz

 tar -xzvf techbrown.tar.gz

tar.bz2

 tar -xjvf techbrown.tar.bz2

tar.xz

 tar -xJvf techbrown.tar.xz

Extract Files in Particular Destination Directory

First of all Extracting files from the tarball. The extraction of tarball can be done using command.

After that Tar ball mainly utilized for the archive of backups.

Finally to get back files that are in compressed state roll backing to its original part is know as extract the tarballs.

tar.gz

 tar -xzvf techbrown.tar.gz -C /home/techbrown/

tar.bz2

 tar -xjvf techbrown.tar.bz2 -C /home/techbrown/

tar.xz

 tar -xJvf techbrown.tar.xz -C /home/techbrown/

After that the Tar Command More Options or Help Manual can be found by using manual command.

 man tar

Congratulations now you have extracted those tarball files using using Linux.