2

After a lot of internet searching and trying just about every option on the man page, I'm stumped.

I use Linux and Mac both regularly in any given day. I've noticed that I prefer the ping command's behavior on Mac and I became interested in finding a way to replicate it on Linux, assuming there must be some combination of arguments to do so. None yet that I can find.

On Mac, if I ping a host, by default it will print something every single second: ping success or ping fail.

On Linux, the default behavior appears to be to batch failure responses into 3-4 second chunks. If you run them side-by-side pinging a dead IP, Mac ping will update every second, Linux will update every 3-4. The behavior is identical if the host is up: they both print a response every second.

I much prefer the Mac behavior of printing every second, success or fail. I have been unable to find any combination of options to get Linux ping to work the same.

There is the "-O" option, which is the closest I've gotten, but it's needlessly verbose: it print two lines for every failed ping instead of just one.

Has anyone else found the right combination of arguments to make Linux ping behave the same as Mac ping?

  • 2
    Try -W 1, and -w 1 – eyoung100 Sep 6 '16 at 17:10
  • 1
    I second using -W 1 since it is likely that the linux failures are waiting for a slow reply. The problem with timeouts is that they are always either too short or too long -- and if the latency to your remote host is greater than 1s then adding -W 1 will give you false negatives. – Jesusaur Sep 6 '16 at 17:43
  • Testing on Arch, Fedora, Debian and Ubuntu, -W 1 still has the buffering I described. Output pauses for 3-4 seconds and then it spits out 3-4 lines. On the Mac output is consistently printed out every second. Try it. No, this is not a huge deal, but it's annoying to me that it buffers and I was hoping there was an easy way to make it behave like Mac's ping. – Mark Sep 9 '16 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.