How to find out your IP in the Linux command line
IP-address is a unique numerical identifier of a device in a computer network. IP addresses are divided into two types: internal (aka private, local) and external (aka public, global).
Internal (private) IP addresses are not used on the Internet. Internal addresses are used in local networks. The internal IP address can only be accessed within the local subnet.
Command “hostname -I
” will display your IP address on the screen. You can also use the command “ip a
“. As a result of execution, a list of current network interfaces and their parameters will be displayed on the screen. Find the interface you are interested in in the list. Its IP address is displayed on the line “inet …”.
External (public) IP addresses are used on the Internet. The public IP address is the IP address under which devices on the Internet see you, and it is unique throughout the Internet. A device with a public IP address can be accessed from anywhere in the global network.
To find out the public IP of your PC, use the command “curl ifconfig.co". The command talks to the server ifconfig.co which returns your IP address in one line instead of a full web page.