I accidentally typedssh 10.0.05instead ofssh 10.0.0.5and was very surprised that it worked. I also tried 10.005 and 10.5 and those also expanded automatically to 10.0.0.5. I also tried 192.168.1 and that expanded to 192.168.0.1. All of this also worked with ping rather than ssh, so I suspect it would work for many other commands that connect to an arbitrary user-supplied host.Why does this work? Is this behavior documented somewhere? Is this behavior part of POSIX or something? Or is it just some weird implementation? (Using Ubuntu 13.10 for what it's worth.)
How is it that missing 0s are automatically added in IP addresses? (`ping 10.5` equivalent to `ping 10.0.0.5`)
ip;hostname
Quoting from man 3 inet_aton:   a.b.c.d   Each of the four numeric parts specifies a byte of the             address; the bytes are assigned in left-to-right order to             produce the binary address.   a.b.c     Parts a and b specify the first two bytes of the binary             address.  Part c is interpreted as a 16-bit value that             defines the rightmost two bytes of the binary address.             This notation is suitable for specifying (outmoded) Class B             network addresses.   a.b       Part a specifies the first byte of the binary address.             Part b is interpreted as a 24-bit value that defines the             rightmost three bytes of the binary address.  This notation             is suitable for specifying (outmoded) Class C network             addresses.   a         The value a is interpreted as a 32-bit value that is stored             directly into the binary address without any byte             rearrangement.   In all of the above forms, components of the dotted address can be   specified in decimal, octal (with a leading 0), or hexadecimal, with   a leading 0X).  Addresses in any of these forms are collectively   termed IPV4 numbers-and-dots notation.  The form that uses exactly   four decimal numbers is referred to as IPv4 dotted-decimal notation   (or sometimes: IPv4 dotted-quad notation).For fun, try this:$ nslookup unix.stackexchange.comNon-authoritative answer:Name:   unix.stackexchange.comAddress: 198.252.206.140$ echo $(( (198 << 24) | (252 << 16) | (206 << 8) | 140 ))3338456716$ ping 3338456716         # What?  What did we ping just now?PING stackoverflow.com (198.252.206.140): 48 data bytes64 bytes from 198.252.206.140: icmp_seq=0 ttl=52 time=75.320 ms64 bytes from 198.252.206.140: icmp_seq=1 ttl=52 time=76.966 ms64 bytes from 198.252.206.140: icmp_seq=2 ttl=52 time=75.474 ms