I want wget to (attempt to) start downloading, then if isn't done after 10 seconds, I want it to give up.

wget --timeout 10 http://url

Seems like a reasonable try, but it seems like it only sets --dns-timeout, --connect-timeout, and --read-timeout. Thus, it could wait 9 seconds for dns, another 9 for connect and then keep downloading forever, as long as data keeps coming at a steady pace (no 10+ second pause).

2 Answers 2


Basically this will be something like:

wget http://www.somesite.com/file.zip &
sleep 10
if [ `ps ax | grep $PID` -ne '' ]
   kill $PID
  • That's one way to solve it, ugly as it is.
    – johv
    Feb 25, 2012 at 12:55

This isn't exactly what you're asking as this should only cause Wget to timeout if the download idles for more than 10 seconds:

wget --read-timeout= 10 http://url

About the --read-timeout option, from the Wget 1.13.4 Manual:

Set the read (and write) timeout to seconds seconds. The “time” of this timeout refers to idle time: if, at any point in the download, no data is received for more than the specified number of seconds, reading fails and the download is restarted. This option does not directly affect the duration of the entire download.

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.