Weedpacket;10903502 wrote:127.0.0.1 🙂
You bastard.:glare:
I was thinking it is kind of disappointing that $SERVER doesn't have some obvious thing for CLI to report the IP address but then I realized that a computer can have multiple IP addresses. That makes the $SERVER var a bit more interesting because it reports some stuff about where you might be SSH'ing from.
So these macs they got no iconfig:
My-Mac:~ sneakyimp$ iconfig
-bash: iconfig: command not found
There is ifconfig which barfs out all kinds of stuff:
My-Mac:~ sneakyimp$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet6 fe80::222:41ff:fe28:91db%en0 prefixlen 64 scopeid 0x4
inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:22:41:28:91:db
media: autoselect (100baseTX <full-duplex>) status: active
supported media: autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,hw-loopback> 10baseT/UTP <full-duplex,flow-control> 100baseTX <half-duplex> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback> 100baseTX <full-duplex,flow-control> 1000baseT <full-duplex> 1000baseT <full-duplex,hw-loopback> 1000baseT <full-duplex,flow-control> none
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:21:e9:e2:b3:28
media: autoselect (<unknown type>) status: inactive
supported media: autoselect
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
lladdr 00:22:41:ff:fe:4a:9f:ac
media: autoselect <full-duplex> status: inactive
supported media: autoselect <full-duplex>
I also found ipconfig which requires that you ask about a particular network interface. I'm guessing en0 might be a pretty good assumption for most Macs:
My-Mac:~ sneakyimp$ ipconfig getifaddr en0
192.168.1.100
There's also the hostname command which might be interesting.
My-Mac:~ sneakyimp$ hostname
My-Mac.local
I'm really just trying to encourage my little mac servers to identify themselves somehow so I can distinguish them in the log files.
EDIT: fixed brackets.