I was downloading from a very intermittent webserver and the download kept quitting less than 80% in. And if my timing wasn’t perfect, the web browser wouldn’t resume it. Then I thought to try to resume my downloads with wget.

wget is a command line tool for Linux, other Unix-like operating systems, and Windows. It is good for resuming downloads and automating other tedious tasks.

When wget fails, it’s usually because the server thinks you’re a robot. Spoof your user agent to make yourself not look like a robot.

Yes, wget, that notorious hacking tool. It’s also the thing I use to fix the dreaded WordPress white screen of death. It worked well. Here’s the trick.

When all goes well, all it takes is:

wget -c url

Copy the address from your browser and paste it into the command line in place of url.

Run the command from the same directory your download is in, and it resumes, regardless of what you used to start the download. The -c option tells wget to pick up at the end of the matching file in the current directory.

And if the server decides to drop on wget, it’s easy to resume. The command is in your command history. Just arrow back up and run the command again. Repeat until you get your file. It can still take some work, but I found the timing was much less sensitive.

Resume downloads with wget when the server doesn’t like wget

Some sites don’t like wget. Because, well, hacking tool! If the download finishes immediately and the resulting file is only a few bytes, that’s what’s going on. The server is detecting wget, deciding you’re up to no good, and giving you a message to that effect instead of the file you want. You can type or cat the file from a command line to verify that’s what’s going on.

To get around this, spoof your user agent. Use the -U argument to do that.

wget -U "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0" -c url

Any valid semi-current web browser user agent string will do. You can use a site like https://www.whatismybrowser.com/detect/what-is-my-user-agent to check yours. Then copy and paste that result into your command line, in between the quotes. Or just copy my example above, it will be good for a while.

Just like before, if the server decides to drop on wget, it’s in your command history. Just arrow back up and run the command again. Repeat until you get your file.

What to do if you get SSL, TLS, or other security errors

I got SSL errors at first, which I traced to using a too-old version of wget. The official GNU wget for Windows is dated and does not support current cryptography standards. Since most of the web uses https these days, that’s a problem. I found a suitable Windows version of wget at eternallybored.org. It’s a standalone version too, which makes it more convenient than the official GNU build, which requires an installer.