Wget – automatically resume broken downloads

Wget is a commandline utility to download files over the http protocols. To download a file for example the syntax would be

$ wget http://www.somesite.com/file.zip

The above command will start downloading the file and save it in the home directory of the user. However if the download breaks, due to poor internet for example then wget will stop the download. Now this could be irritating for large downloads when you need to check if the downloading is going on fine.

When the internet is flaky, what happens is that wget tries to connect and when it cant, it thinks that the server is down or does not exist anymore. Therefore we need to tell wget even if the connection is refused.

The retry-connrefused option tells wget to reconnect even if the earlier connection attempt had failed, so effectively wget will keep connecting everytime the internet goes down and comes up again. This makes automatic download of large files more reliable.

The tries=0 option tells wget to keep trying infinitely.

However even this technique has limitations, for example if the connection exists but data transfer fails, then wget will think that no data is being served and would quit.

This site, binarytides.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com.