Search code examples
linuxwgettar

why wget change file type?


I am downloading a tar.gz file using this command:

wget -c http://example.com/example.tar.gz

When download complete,check file type:

file example.tar.gz

The output is:HTML document text.Unpack file:

tar -zxvf example.tar.gz

The output:

gzip: example.tar.gz: not in gzip format

Why would this happen? What should I do to make it right? I am absolutely sure it is a tar.gz file because if U change the way I download it, I can successfully unpack it. This command makes it work:

curl -O http://example.com/example.tar.gz

Solution

  • wget doesn't change the file format. http://example.com/example.tar.gz, despite what it's name may suggest, isn't a tar.gz archive, but just a plain old HTML page.