How to solve: This does not look like a tar archive

Problem:

Sometimes compressed files are not what they look from the extension. Recently I downloaded a .tar.gz file (say, we call it as filename.tar.gz) but when I tried to extract it, it gave error. It went something like this:

command: tar xvzf filename.tar.gz 
output: tar: This does not look like a tar archive 
tar: Skipping to next header 
tar: Exiting with failure status due to previous errors 

Reason:

The error says it all. This does not look like a tar archive. What does it look like than? The way to find it out is using “file” command in the following manner:

command: file filename.tar.gz 
output: filename.tar.gz: gzip compressed data,from Unix

Solution:

So here we go. a gzip compressed data. The best way to deal with it to use “unzip” command line tool. You can install it using this command:

sudo apt-get install gunzip 

Now loaded with gunzip we are ready to tackle this file. First gunzip the file to a .tar file and then untar it using tar command somewhat in following manner:

gunzip filename.tar.gz 
tar xvzf filename.tar 

Hope the post has helped you. Feedback, suggestions are most welcome. Enjoy :)