34

How do I resume a partially downloaded file using a Linux commandline tool?

I downloaded a large file partially, i.e. 400 MB out of 900 MB due to power interruption, but when I start downloading again it resumes from scratch. How do I start from 400 MB itself?

  • 5
    What commandline did you use to download the file in the first place? – Anthon Nov 4 '14 at 10:34
  • 3
    Please don't answer in a comment, update your incomplete question. – Anthon Nov 4 '14 at 11:22
  • 1
    If you are using curl, you should search the man page for the -C option. – HalosGhost Nov 4 '14 at 14:22
50

Since you didn't specify, I'm assuming you are using wget to download the file. If this is the case, try using it with the -c option (e.g. wget -c <URL>).

Please notice that in case the protocol used is ftp (the URL looks like ftp://...) there is a chance the remote server uses an old/ancient ftp daemon which doesn't support resuming downloads (newer ftp daemons do support it for more than a decade anyway, so this is just a small chance). If this is the case, though, you may be out of luck. In the other hand you should have no issues if the protocol used is http. (UPDATE: According to other experts (including Gilles in the comments below), resuming while using http is also subject to the server support, so this apply to both ftp and http).

Good luck.

  • 5
    HTTP downloads can only be resumed if the server supports it, and that's rarer than with FTP servers. – Gilles Nov 4 '14 at 18:10
  • Thank you Gilles, I only had good experiences with resuming while using http, but you are probably right and I'm lucky. Will update the my answer. – Marcelo Nov 4 '14 at 20:19
  • wget -c http:... has worked the 3 or 4 servers I've tried it on. – Bob Stein May 28 '15 at 1:36
  • God bless you man! – learner Aug 19 '16 at 18:22
  • 3
    @Gilles: Actually, this is now a common option with any static content from servers newer than ~2010 (in other words, most servers allow Range requests for static files by default). For dynamically generated data, this is indeed rare. – Piskvor Feb 3 '17 at 13:06
0

I know what the original question mean, and the answer is not wget -c ...

The scenario can be described like this:

# Start mirroring a site
wget -m http://...
# 400MB later wget died or interrupted,
# don't know where it left off, don't care,
# just want to get the remaining 100MB without getting the first 400MB again
wget -nc -r -l inf --no-remove-listing http://...

Options "-r -l inf --no-remove-listing" is equivalent to -m without the -N parameter. Adding the -nc parameter avoid saving the first 400MB already in your hard drive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.