Linux How To Find Your IP Address
Finding your IP address on Linux is pretty easy. As with most things there are multiple ways to accomplish this. We are going to start out by showing you how to look up your IP on the local network which will probably be a private IP. Keep reading to see how to also find your public, internet facing IP.
You can use the hostname command to view all IP addresses for the host like this:
You can use the command “ip addr” to list out all interfaces and their IP addresses. This command is relatively new but has still been around for many years. You can also just specify “ip a” for short.
ip addr ip a
An older but still useful command is the ifconfig command. You can run the following to show all interfaces that are up and what IP addresses they have been assigned. Use a “-a” to show all interfaces even if they are down.
ifconfig ifconfig -a
Find Your Public IP
Any of the following commands should show you what your public, internet facing IP is. If you are a home user there is a good chance you are behind a NAT.
curl icanhazip.com curl checkip.dyndns.org curl ifconfig.me curl ipinfo.io/ip curl api.ipify.org