Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need the option of ping which,If the net is disconnected, the pinging need to be stopped.Now if the net connection lost,It will wait and will continue after net came..

share|improve this question

1 Answer 1

up vote 4 down vote accepted

See man ping

-c count

Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the time‐ out expires.

$ ping www.google.nl -c 5
PING www.l.google.com ( 56(84) bytes of data.
64 bytes from ez-in-f104.1e100.net ( icmp_req=1 ttl=53 time=18.4 ms
64 bytes from ez-in-f104.1e100.net ( icmp_req=2 ttl=53 time=18.8 ms
64 bytes from ez-in-f104.1e100.net ( icmp_req=3 ttl=53 time=15.1 ms
64 bytes from ez-in-f104.1e100.net ( icmp_req=4 ttl=54 time=16.8 ms
64 bytes from ez-in-f104.1e100.net ( icmp_req=5 ttl=54 time=19.6 ms

--- www.l.google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 15.133/17.781/19.660/1.615 ms
share|improve this answer
That was a fast aswer. :) :)..thanks genius –  Abdul Shajin May 23 '11 at 20:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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