Some ways to get your ip address both local and public.
hostname -I
ip route get 8.8.8.8 | awk '{print $NF; exit}'
ifconfig | grep inet
curl ipinfo.io/ip
curl icanhazip.com
curl ipv4.icanhazip.com
curl ipecho.net/plain ; echo
curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
curl http://checkip.amazonaws.com
wget -qO- http://ipecho.net/plain ; echo
wget -qO- icanhazip.com
dig +short myip.opendns.com @resolver1.opendns.com
telnet myip.gelma.net
lynx bot.whatismyipaddress.com