To untar a TAR file inside a gzip formatted file, just type the following in your terminal tar -zxvf filename.tar.gz. This command with extract all the contents in the same directory. If the file is only on a TAR format, only include the following command tar -xvf filename.tar.