What was the rationale for the design decision to make ping's default behavior to ping forever?

For example, the following basic usage will ping address forever:

$ ping

According to Wikipedia, ping is used to:

test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer and back.

In both of those use cases (reachability and round-trip time/latency), pinging forever is probably not the desired behavior, which is why it seems odd to me that it is the default behavior.

As a side note, it seems even more odd considering there is no provided user interface mechanism to quit, other than something like ctrl + c, which seems a little unrefined.

Of course the number of pings can optionally be limited if the count parameter (-c) is used, e.g.:

$ ping -c 3


To clarify, I'm hoping someone can provide a reference of some sort which mentions the reason the actual developer(s) decided on the default behavior, rather than opinion-based answers. Perhaps documentation or code comments exist which document this?

I see this question is currently on hold as being primarily opinion-based, so I'm trying to make it less so.

  • 3
    Perhaps a better question would be "Why does ping not run forever by default in Windows"? The answer to both is that the devs decided on this. Both options make sense. "Reachability" can be tested easily if the pings never stop, to test network drop-outs. – Sparhawk Jan 14 '16 at 21:43

Imagine you want to establish a route between hosts A and B.

On host A, you run ping B. Initially, it won't work.

On host B, or on some firewall, you make a change to the network configuration and the moment it is applied you see almost instantly that your change worked.

So, it's just very practical that it does that. Otherwise you would have to write while ! ping B; do :; done, which is more work.

In the end all of these types of questions generally end up with "Because of system resource limitations at the time" or "common sense". In this case it is "common sense".


Different implementations, different choices.

In iputils-ping (on Linux) the ping is continuous by default while on Solaris you need to use the -s option to get that behaviour. That's useful for monitoring network status continuously.

On Solaris ping's default behaviour of exiting successfully after the first returned packet makes it easier to use in scripts to test connectivity, whereas with iputils-ping you have to use ping -c1 -w15 to get (something like) the same behaviour.

Both are useful in different circumstances.

Different developers, different choices.

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