cat file-that-failed-to-download.zip | curl -C - http://www.somewhere.com/file-I-want-to-download.zip >successfully-downloaded.zip

use curl to resume a failed download

If you are downloading a big file (or even a small one) and the connection breaks or times out, use this command in order to RESUME the download where it failed, instead of having to start downloading from the beginning. This is a real win for downloading debian ISO images over a buggy DSL modem. Take the partially downloaded file and cat it into the STDIN of curl, as shown. Then use the "-C -" option followed by the URL of the file you were originally downloading.
Sample Output
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17.1M  100 17.1M    0     0   746k      0  0:00:23  0:00:23 --:--:--  793k

-1
2009-08-05 13:33:06

1 Alternatives + Submit Alt

What Others Think

Using wget looks simpler: wget -c http://www.somewhere.com/file-I-want-to-download.zip -O file-that-failed-to-download.zip
Decoy · 458 weeks and 5 days ago
Decoy is correct. We usually use "wget -c ..." after cd to the dir where the file resides.
totti · 355 weeks and 4 days ago
why to use the cat command? I mean: the simplest way to accomplish this task would be doing something like: curl -C - -L -O http://www.somewhere.com/file-I-want-to-download.zip Of course, the above command should be entered in the same directory where the file-I-want-to-download.zip is. Agree or not agree?
chapeupreto · 346 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: