$ tar xvzf filename.tar.gz
To extract the .gz file without tar, you can use the following command:
$ gunzip filename.gz
If your tar file is compressed using a bZip2 compressor, use the following command to extract it.
$ tar xvjf file.tar.bz2
Where ‘j’ will decompress a bzip2 file.