250

Today, I learned the shortest command which will determine if a ping from your machine can reach the Internet:

ping 1.1

This parses as 1.0.0.1, which thanks to Cloudflare, is now the IP address of an Internet-facing machine which responds to ICMP pings.

Oh, you can also use this trick to parse 10.0.0.x from `10.x` or 127.0.0.1 from `127.1`. It's just like IPv6's :: notation, except less explicit.

Comments
  • 3
    Tnx, I'll try it out! Not sure though if that would work on all OS's
  • 13
    You are correct, and that's amazing.
  • 7
    More random things like this one it's what we need here!
  • 0
    @fuck2code that's gnome terminal with very little transparency. You can find it on Edit > Profile Preferences > Colors

    The prompt is custom made.
  • 11
    @SheShell great idea, thanks!

    If you don’t mind, so it doesn’t get lost in the shuffle, please create a GitHub issue in the issue tracker.

    But I really do like the idea. We have something semi-similar in the works in terms of sharing a specific kind of knowledge (I don’t want to spoil it haha) but your idea is more like a TIL type maybe.
  • 3
    @SheShell I was gonna write the same, it has been in my mind for past week thanks for writing it down.
  • 2
    'man inet_ntoa' will explain how shorthand IPs like these will be parsed
  • 0
    Thanks
Add Comment