Find Public/Private IP Address


How to get Public/Private IP Address in Linux/Windows Terminal

The following commands will get you the IP address list to find public IP addresses for your machine:

wget -O - -q https://checkip.amazonaws.com
curl -s https://icanhazip.com
curl -4[|-6] icanhazip.com
curl ifconfig.co
curl ifconfig.io && echo
curl ifconfig.me/all
curl ipconfig.in/ip
curl ipinfo.io/ip[|city|region|country|loc|org|postal|timezone|readme]
curl api.ipify.org
curl checkip.dyndns.org
dig +short myip.opendns.com @resolver1.opendns.com
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
curl ident.me
curl ipecho.net/plain ; echo

The following commands will get you the private IP address of your interfaces:

ipconfig -all
ifconfig -a
ip addr show (ip a)
hostname -I[/-i] | awk '{print $1}'
ip route get 1.2.3.4 | awk '{print $7}'
(Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen
nmcli -p device show

Note: Some utilities need to be installed on your system based on the Linux distro you are using.
Also, some of the noted commands use a third-party website to get the IP