How to solve: stdin: not in gzip format
Problem: I tried to unzip a file MyFile.tar.gz which looked like a gzipped file by the name. But while unzipping I encountered an error “gzip stdin not in gzip format” which was as following:
$tar xvzf MyFile.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
The error indicates that the file is not in gZipped format. Then which format is it in? To find out, I ran the ‘file’ command on it:
file MyFile.tar.gz
MyFile.tar.gz: POSIX tar archive (GNU)
Reason: Reason for the error is quite evident. The file is not a gzipped file but a POSIX tar archive file. Which means it was not zipped at all but instead it was compressed using tar. It was simply renamed afterwards, I believe.
Perhaps the creator of the file wanted to gzip a directory but couldn’t do that because the directory needs to be archived using tar first. Confused? I recommend reading this article to learn the difference between tar and zip.
Solution: Since it was not a gzipped file, a simple tar is able to extract the file:
tar xvf MyFile.tar.gz
Now that’s how I fixed this problem. I advise you run the file command on your file and see what kind of archive file it is.
If your file too is in POSIX tar archive format, you can use the same command that I have used in the above example.
If it’s in some other archive format, then you should run the appropriate command to extract the archive file. You have to search on the internet a bit about how to extract that certain kind of archive file. It should not be a difficult task if you have even a little bit of experience with Linux commands.
I hope you found it helpful. Cheers :)