Quick tip - recover a failed download using Wget

GNU wget is a brilliant tool for downloading. Whether it's from the web, FTP or elsewhere, wget is a very powerful and useful tool.

Unfortunately, internet connections are often far from completely stable and if you're downloading something and that download subsequently fails, it can be quite frustrating (especially if it's a big file).

In the vast majority of cases though, there's no need to go about deleting the file and restarting the download from scratch. Wget includes a -c switch that you can use to continue a failed download from where you left off.

Say we're downloading a big file:

$ wget bigfile

And bang - our connection goes dead (you can simulate this by quitting with Ctrl-C if you like). Once we're back up and running and making sure you're in the same directory you were during the original download:

$ wget -c bigfile

Provided where you're downloading from supports it, you should get going from exactly where you left off.

It's a nice quick tip, but it can be a real time (and sanity) saver when you've got a dodgy connection!

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Quick tip - recover a failed download using Wget

  1. kevin (guest)

    # Posted on 10 September 2007 at 04:31 PM

    I used to use that for some video downloads, but the vids kept on getting corrupted if the dl resumes. ie, there would be considerable gaps in the vids, i suspect at the locations where the resume was triggered. Not sure if it's an isolated problem (just for me), but it was happening every single time, which drove me to use another download manager for big files...

    anyone else encountered this?

    or maybe there's a way to go back x kb when resuming?

  2. babakin sergey (guest)

    # Posted on 11 September 2007 at 12:39 AM

    I think better to use: $ wget -t0 -c bigfile

    -t0 - unlimited number of retries -c - resume getting partially downloaded file

    If server not available for some time downloading will be resumed as soon as it become available.

    P.S. sorry for my English

  3. c0dehunter (guest)

    # Posted on 22 June 2008 at 07:20 PM

    Thanks so much for this.

  4. guillermo (guest)

    # Posted on 23 May 2009 at 04:08 PM

    That's exactly what I need !

    Thank you

  5. vasiauvi (guest)

    # Posted on 19 May 2010 at 03:05 PM

    Thanks, I've started to download with wget a Linux DVD and from 3.9GB I've downloaded 3.8 :D and like you sayd "Bang" the computer restarted because of a power issue. After that found your post and now it's OK :D

Home » Articles » Quick tip - recover a failed download using Wget