5

The BSD version of Ping(8), notably on OS X, includes a convenient "one ping only" option (-o) that mirrors Sean Connery's famous quote from Hunt for Red October. The option terminates Ping once the first reply is received.

I am trying to find out when the option was added or dropped from Ubuntu's Ping implementation. A note on Ars Technica's forum seems to hint that this is an older option (and perhaps has now been dropped?).

Any historical insight would be useful.

Why is this handy? Because you can do stuff like this:

ping -o 1.2.3.4; ssh ubuntu@1.2.3.4 

and it will connect you with the server as soon as it becomes available on the network.

10
  • 7
    If you're looking for BSD history, the appropriate site would be Unix & Linux.
    – muru
    Jun 1, 2018 at 2:31
  • 3
    @Rinzwind the difference with -o is that -o pings until you get one reply, and -c 1 pings exactly once, no matter the reply.
    – muru
    Jun 1, 2018 at 7:58
  • 1
    @muru AFAIU the question was "When was this dropped in Ubuntu" and I seem to have uncovered the truth... Voting to reopen! ;-)
    – Fabby
    Jun 7, 2018 at 22:16
  • 1
    0xF2 thanks for the upvote and acceptance. Favour returned: question upvoted! P.S. Please let me know what the Vasiliy reference is???
    – Fabby
    Jun 9, 2018 at 20:51
  • 1
    :D Thanks. Saw that movie, but only once!
    – Fabby
    Jun 20, 2018 at 20:41

1 Answer 1

7

Today:

Use:

until ssh ubuntu@1.2.3.4 ; do sleep 0.25; done

to ssh into the server the moment it becomes available.

The past:

The earliest source code of the GNU inetutils I could find that contained ping is:

2001-06-13  Sergey Poznyakoff
    * ping.c: implemented
    * ping_address.c, ping_echo.c, ping_impl.h, ping_router.c,
      ping_timestamp.c: added to repository.

and that did not contain the -o parameter... So we can safely conclude that this option did not exist in 2001 and as Warty Warthog was released in 2004 we can prove beyond any doubt that this option never existed in Ubuntu.

;-)

7
  • So to emulate the effect of -o as of muru’s comment, something like until ping -c1 8.8.8.8 >/dev/null;do :;done?
    – dessert
    Jun 7, 2018 at 22:04
  • 1
    Edited... @dessert Vote to reopen then!
    – Fabby
    Jun 7, 2018 at 22:15
  • Sounds like the -o option was never added to the GNU implementation... thanks for all the research!
    – 0xF2
    Jun 9, 2018 at 19:50
  • Turns out that to wait for ssh to come up there is actually a simpler solution: until ssh ubuntu@8.8.8.8 ; do sleep 1; done
    – 0xF2
    Jun 9, 2018 at 19:54
  • 1
    Why ssh into Google DNS server ? O.o Someone could really misunderstand that Jun 9, 2018 at 21:33

Your Answer

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

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