Troubleshooting: curl/wget Fetching HTML Instead of Files
Lyner Lim
Posted on October 26, 2024
Have you ever tried to download a file using curl or wget, only to end up with an HTML page instead? It’s likely that the URL isn’t pointing directly to the file. Let’s use downloading a file from GitHub as an example.
If you just click on the file like this link (https://github.com/docker/docker-install/blob/master/install.sh), right click to inspect and you will see it is in html.
What we should do is click on the Raw to get this link (https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh).
Now, wget https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh
or curl -O https://raw.githubusercontent.com/docker/docker-install/refs/heads/master/install.sh
will download the install.sh file to your local directory.
Posted on October 26, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024