Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run the ping command, I often do so with the goal in mind to learn when a particular machine has come up, e.g. from rebooting. But recently (read: in the last few years) I have noticed that after 10 or 15 seconds of not getting a reply, ping start getting extremely chatting, repeatedly displaying "Destination Host Unreachable" every second! This is extremely annoying. One of the great diagnostic uses of ping used to be that any output at all meant that the host was up.

So, how can I get rid of this stupid annoying behavior and have it only print actual pings? These "Destination Host Unreachable" are not going to stderr like I would expect a well behaved program to do with errors, so I can't redirect stderr to get rid of them!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

"Destination host unreachable" is given, when the system does not know how to send the ping request to the remote host in the first place. It means that your system or a router in between does not have a routing table entry/rule that allows it forward the packet to the router responsible for that network.

And it is getting "extremely chatty" because this happens for every packet (i.e. it is not lost, but essentially you are getting a "don't know how to deliver this packet" message back for each).

You could filter them out via grep though

ping 192.168.5.1 | grep -v "host unreachable"
share|improve this answer
    
I may be wrong but I believe under Linux it will work in real time. –  collaborator Oct 8 '12 at 18:54
    
I stand corrected, I was being an idiot, downvote removed, upvote added. –  terdon Oct 8 '12 at 18:55
    
Much appreciated. –  collaborator Oct 8 '12 at 18:58
add comment

The -i option could help you(from the ping man page):

    -i interval
           Wait interval seconds between sending each packet.  The
           default  is  to wait for one second between each packet
           normally, or not to wait in flood mode. Only super-user
           may set interval to values less 0.2 seconds.
share|improve this answer
add comment

Your Answer

 
discard

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.