Reference: 3 Easy Ways to Find IP address in Linux
Find private ip address for all network interfaces in Linux
ip a
ip addr
ip address show
ifconfig -a
Check private ip address for specific network interface in Linux
ip addr show dev eth1
ifconfig eth1
Check private ip address in bash script
ip -4 -o a | cut -d ' ' -f 2,7 | cut -d '/' -f 1
ip -4 addr show eth0 | grep -oP "(?<=inet ).*(?=/)"
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
Check public ip address in Linux
curl ifconfig.me/all
dig +short myip.opendns.com @resolver1.opendns.com