Home > Article > Operation and Maintenance > How to check IP in Linux
Knowing your device's IP address is important when troubleshooting network problems, setting up new connections, or configuring firewalls. Let’s take a look at how to check the IP address in Linux!
Linux method of checking ip
In Linux, the standard command for displaying and configuring network interfaces is ip .
To display a list of all network interfaces and related IP addresses, type the following command:
ip addr
The command execution results are as follows:
You can also use the following command to display the internal IP address:
hostname -I ifconfig
To view the public IP, you can use any of the following commands:
dig ANY +short @ resolver2.opendns.com myip.opendns.com dig ANY +short @ resolver2.opendns.com myip.opendns.com dig ANY +short @ ns1-1.akamaitech.net ANY whoami.akamai.net
(Online video tutorial sharing: linux video tutorial)
The above is the detailed content of How to check IP in Linux. For more information, please follow other related articles on the PHP Chinese website!