Here are the commands to find internal and external IP address in Ubuntu terminal.
Internet Protocol Address (IP Address)
An Internet Protocol address (IP address) is a numeric label assigned to each device connected to a computer network that uses the Internet Protocol to communicate. An IP address has two primary functions: identifying a host or network interface and addressing a location.
IP addresses are recorded and displayed in human-readable notations, such as 172.16.254.1 in IPv4 and 2001:db8:0:1234:0:567:8:1 in IPv6. The size of an address’s routing prefix is indicated in CIDR notation by adding a number of significant bits to the address, such as 192.168.1.15/24, which is equivalent to the historically used subnet mask of 255.255.255.0.
Note. Internet Protocol Version 4 (IPv4) defines an IP address as a 32-bit number. A new version of IP (IPv6), using a 128-bit IP address, was standardized in 1998.
Find your IP address – GUI method
Find your internal (network) IP address
- Open the activity overview and start typing Network.
- Click Network to open the panel.
- Select your connection: Wi-Fi or wired in the left panel.
- The IP address for the wired connection will be displayed on the right.
- Click the settings button to see your wireless network IP address in the details panel.
Find your IP address – Terminal commands
The easiest way to find out the internal IP address is to use the ip command in a terminal. Just open a terminal and run the following command:
$ ip a
$ ip address
The ip command is used to display or manage routing, devices, routing policies, and tunnels in the system. The “address” command option is used to display the IP address or IPv6 address on the device.
You can also use other commands to find the IP address:
$ hostname -i
$ ip addr show
Find your external IP address – GUI method
An external or public IP address is used on the Internet to locate computer systems and devices. The external IP address is for accessing the public Internet through the router, while the internal IP address is for the home network.
Run the following command to find the external IP address:
$ curl -w "\n" -s https://api.ipify.org
$ curl ifconfig.me