Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web application that runs through thousands of IP addresses and checks if they're online. Basically, if a server uses more than 250ms to respond, it's considered offline in our case. It would be an enormous timesaver if we could get the ping command to give up after about 300 ms, instead of what seems to be the minimum value of the -W parameter, 1 second.

share|improve this question
up vote 6 down vote accepted

Found a similar question out there, and the answer was a ping alternative called fping. Maybe it'll be of some use to you.

share|improve this answer

From the man pages on ping it looks as though it is the -o to send only 1 packet...

ping -W 250 -o

That should return much more quickly also the -W parameter is in milliseconds, so that should send 1 packet and only wait 250ms for a response.

EDIT You Sure?:

$ ping -W 250 -o
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=51 time=18.850 ms
--- ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 18.850/18.850/18.850/0.000 ms
share|improve this answer
ping: invalid option -- 'o' – Hubro Mar 30 '11 at 3:09
@codemonkey Are you sure? What Distro are you using? – Joshkunz Mar 30 '11 at 3:26
Debian GNU/Linux 6.0 – Hubro Mar 30 '11 at 3:31
My apologies I didn't realize that the darwin ping utility was so different, looks like fping should give you the added functionality you need. – Joshkunz Mar 30 '11 at 3:38
Out of curiosity, what Distro were you using? Debian 7? – Hubro Dec 15 '14 at 20:13

Running on Mac Maverick. Pings 256 addresses in 39 seconds, i.e., 151ms / ping.

$cat netcheck
  test $i -ge 0
    ping -i .1 -c 1 -W 50 $address > /dev/null
    echo $address
  let i=$i-1
$time ./netcheck

real    0m38.653s
user    0m0.369s
sys 0m0.616s
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .