How Do You Troubleshoot “This does not look like a tar archive” when Trying to Download a .tar.gz File with Linux?

One of the below problem scenarios is happening.

Possible problem scenario #1
You try to download a file with curl or wget. Instead of downloading the file, you get a file with this as the content:

gzip: /home/ubuntu/foobar.tar.gz: not in gzip format
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

You use a web browser, and you can download the file. You know the website works perfectly. Why cannot you download the file on a Linux machine (using the character prompt)?

Possible problem scenario #2
You run curl or wget, and you see that you are being redirected. What flag should you use with curl to get it to work?

Possible problem scenario #3
You try to run a curl command, but you get this error message:
curl: (3) URL using bad/illegal format or missing URL

Solution
Use a command like this:

curl -L https://www.continualintegration.com/foobar.tar.gz --output /tmp/foobar.tar.gz

# Replace https://www.continualintegration.com/foobar.tar.gz with the URL you are downloading the .tar.gz file from
# Replace /tmp/foobar.tar.gz with the destination location and desired name of the file you are downloading

Leave a comment

Your email address will not be published.