The file extensioed as .tar.gz files are gzip-compressed tarballs, compressed archives like .zip files. .tar.bz2 files are compressed with bzip2.

Extracting .tar.gz files

 tar xzf file.tar.gz

Extracting .tar.bz2 files

tar xjf file.tar.bz2

Extracting .tar.xz files

tar xJf file.tar.xz

If you would like to see the files being extracted during unpacking, add v:

tar xzvf file.tar.gz

Extracting a single file

tar xvf file.tar.gz testfile1

Extracting a single file to another directory. (directory must be existed)

tar xvf file.tar.gz -C anotherDirectory/ testfile1

After extracting, you can install as follow:

sudo make install

Instead, you can also install online as follows.

sudo apt-get install PACKAGENAME

References :