Solve the error when decompressing files using tar command: gzip: stdin: not in gzip format

wrong description

Downloaded the installation package of Apache ZooKeeper 3.7.0 fromApache ZooKeeper, but when using "tar zxf" to decompress the file, The following error is reported: gzip: stdin: not in gzip format
Insert image description here

problem analysis

  • Looking at the error description, stdin: not in gzip format actually explains the problem, that is, the file is not in gzip format. You can use the "file" command to view specific information about a file:
file apache-zookeeper-3.7.0-bin.tar.gz.1 
apache-zookeeper-3.7.0-bin.tar.gz.1: HTML document, ASCII text, with very long lines
  • This file was found to be an HTML document. Back to the Apache ZooKeeper official website, the file I downloaded at the beginning was a file that I directly copied the link in the picture below and then used the wget command to download it.
    Insert image description here

  • Next, I clicked "Apache ZooKeeper 3.7.0" first, and then found that there was a download link inside. After using the download link inside to download the file, the tar was decompressed successfully:
    file
    For the new file, use the file name to view the content as follows, indicating that it is indeed a gzip file:

file apache-zookeeper-3.7.0-bin.tar.gz 
apache-zookeeper-3.7.0-bin.tar.gz: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)

Summarize

  • The tar zvf command reports "gzip: stdin: not in gzip format". The root cause is still a file format problem. So if you encounter the same error, you need to check whether the source of your file is incorrect.
  • I encountered this error because when I downloaded the file in the first step, I just saved the web page corresponding to the link, and the final path of the web page happened to be: apache-zookeeper-3.7.0-bin.tar.gz , so it looks like a compressed file, but is actually an HTML text file

Guess you like

Origin blog.csdn.net/weixin_42534940/article/details/116892725