Tar command is very helpful to stores and extracts files from a tape or disk archive. This post describes  how we can extract that file formats are  .tar.gz (or) .tgz (or) .tar

tar -zxvf FILENAME.tar.gz

x: Stands for "--extract"  which means extract files from an archive

v: Stands for "--verbose" This option will list all of the files one by one in the archive. 

z: This option is important and tells the tar command to uncompress the file (gzip, gunzip,ungzip).

f: Tells tar that you are going to give it a file name to work with.

Some examples to extract  files using the commands,

Extract .tgz file,

$ sudo  tar xf archive.tgz

Extract tar.gz file,
$ sudo  tar xf archive.tar.gz

List all files in archive.tar verbosely.
 $  sudo tar -tvf archive.tar 

Extract all files from archive.tar.
$ sudo tar -xf archive.tar