Last Updated: May 04, 2017
·
347
· phaus

get IPs via CLI

Linux

IPv4

ip addr show eth0 | grep inet | grep eth0 | awk '{ print $2 }' | sed -r 's/\/24//g'

Darwin / MacOS

IPv4

ifconfig en0 inet | grep inet | awk '{ print $2 }'

IPv6

ifconfig en0 inet6 | grep inet | awk '{ print $2 }'