260

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
  • 4
    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!
  • 4
    Hey, thanks for sharing! This post added a new thing to my knowledge.
  • 32
    @dfox Just an idea: it'll be great to have a "share knowledge" section here on devRant where everybody can share the little new things they learn, like the one in this post ^

    That way the community will also be able to grow together as professionals (although the rants and other similar posts are also helpful but a separate section dedicated to learning would be great too I think).
  • 0
    @fuck2code that's gnome terminal with very little transparency. You can find it on Edit > Profile Preferences > Colors

    The prompt is custom made.
  • 12
    @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.
  • 4
    @dfox Oh cool :D Eagerly waiting for the update!

    Yeah, I'll add it to the issue tracker 👍
  • 3
    @SheShell I was gonna write the same, it has been in my mind for past week thanks for writing it down.
  • 3
    'man inet_ntoa' will explain how shorthand IPs like these will be parsed
  • 0
    Thanks
  • 0
    @dfox

    A better search tool would help, since I can't find stuff I wrote a few months ago, let alone someone else's useful post !

    With fuzzy logic, eg. it can find things with not 100% matching spelling.

    I thought I may as well ask for two impossible things at once. :-)
Add Comment