Cyberithub

Solved "gzip: stdin: not in gzip format" error in Linux/Unix

Advertisements

In this article, we will see how to solve "gzip: stdin: not in gzip format" error in Linux/Unix based systems. Many times you might have observed that while trying to extract compressed file using tar command, you get "gzip: stdin: not in gzip format" error in your system. This error can only occur in few scenarios which I am going to explain below. But before that let me explain more about gzip compression and decompression.

gzip, also known as GNU Gzip, is a popular data compression program developed under GNU Project. This program can be used both for compression and decompression. It is usually used in conjunction with tar archival to reduce the original final size significantly hence producing the final output in tar.gz format. That's why you will find many of the packages available for download in this format only. It results into smaller file size and hence make download quicker and faster.

Advertisements

 

Solved "gzip: stdin: not in gzip format" error in Linux/Unix

Solved "gzip: stdin: not in gzip format" error in Linux/Unix

Also Read: How to Install Flutter on Ubuntu 22.04 LTS (Jammy Jellyfish)

Now coming back to the point, as I was discussing gzip: stdin: not in gzip format error could occur when you try to extract .tar.gz or any other file format such as .tar.xz using tar command. But this can only happen in two different cases. Let's see both the cases one by one.

Advertisements

 

Case 1: When target is not gzip format file

In most of the cases, you will see gzip: stdin: not in gzip format error due to target file not in gzip format even though it looks like in tar.gz format as you can see in one of the instances below. Due to some reason this file is either moved or renamed as tar.gz file. So in that case it is also difficult to find out the real file format to extract it properly.

cyberithub@ubuntu:~$ tar -xzvf artifactory-pro.tar.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

It is also possible that the file may not be archived also, in that case if you just run tar -xvf artifactory-pro.tar.gz command then also you will get the same error.

Advertisements
cyberithub@ubuntu:~$ tar -xvf artifactory-pro.tar.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

But if one knows the original format of the file then they can extract it properly by using the correct option with tar command or with correct utility.

 

Case 2: When -z option used on other file format

Another most frequent mistake that users always do is that they use -z option with tar command on files which are not compressed in gzip format. Probably the file was just archived and not compressed. So this again result into gzip: stdin: not in gzip format error as you can see below.

Advertisements
cyberithub@ubuntu:~$ tar -xzvf flutter_linux_3.13.0-stable.tar.xz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

In those cases, to fix the error you just need to remove -z option as there is no gzip compression done and run above command without filtering through gzip then it will work properly and the files will be extracted without any error.

cyberithub@ubuntu:~$ tar -xvf flutter_linux_3.13.0-stable.tar.xz

 

Conclusion

Hope above explanation would be enough to explain you the error and solution that you need to take based on the use case scenario in your system. But even after following above steps, if you are still facing the same error then don't hesitate to write me about your problem in comment box so that we can work together to solve your problem as well.

Leave a Comment