p:: CLI

curl -s ipv4.icanhazip.com

Get Local IP Address

ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p'

macOS

ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'