How To Ping a Server for a few Seconds

While learning about the Docker Network feature I stumbled about a usefull ping option I didn't know before. -w SEC. With SEC being the seconds until ping exits.

$ ping -w3 172.17.0.3
PING 172.17.0.3 (172.17.0.3): 56 data bytes
64 bytes from 172.17.0.3: seq=0 ttl=64 time=0.124 ms
64 bytes from 172.17.0.3: seq=1 ttl=64 time=0.103 ms
64 bytes from 172.17.0.3: seq=2 ttl=64 time=0.102 ms

--- 172.17.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.102/0.109/0.124 ms

Nice.

Show Comments