An IP address is similar to your house number or address. When your Ubuntu device joins a network, it gets assigned two addresses: Private and Public. The Private address is like the apartment number in a building. This IP address is used inside your internal private network for devices connected to your system, such as printers, output displays, etc. The Public address is like your house number on the street, visible on websites you visit.
Knowing your IP address is helpful for troubleshooting network problems or allowing IT support to connect to your device remotely. Luckily, Ubuntu has different methods for getting system IP addresses. All methods for IP address retrieving will be discussed here.
Table of Contents
How to Find IP Address on Ubuntu
To find the IP address, you can use the ip command. This is the simplest method of knowing the IP on an Ubuntu machine. However, other commands, like hostname, networkctl, and ifconfig, can also help you find the IP address on Ubuntu. You can also find your IP address through your system’s graphical interface (GUI).
Let’s check these commands to find the IP address on Ubuntu.
1. hostname Command
The hostname command on Ubuntu is primarily used to configure a system’s hostname but can also retrieve some IP address information.
To check the IP address using the hostname command, open a terminal window, type the following command, and press Enter:
hostname -I
The -I flag instructs the hostname to display IP address information. If you see an IP address listed, that’s likely your private IP address on the local network.
The hostname command is not the most reliable method for finding your IP address on Ubuntu. It only displays the IP address associated with your hostname and doesn’t show all IP addresses assigned to your system.
For more reliable methods of finding your IP address on Ubuntu, consider using the ip command.
2. ip Command
The ip command is the recommended way of getting the IP address on the Ubuntu system. It is an updated version of the older ifconfig command with more in-depth analysis. It gives a comprehensive report of all assigned IP addresses to the system’s network interfaces.
To get started, open the Ubuntu terminal and type this command:
ip a
This will display a detailed listing of all your network interfaces and their assigned IP addresses.
Focus on the one you’re currently using to access the internet (wired or Wi-Fi). Look for the line mentioning inet addr followed by the IP address. This is your internal IP address within your local network.
Remember, you will see several interfaces listed if you have multiple connections active. Just pick the one that matches your active internet connection.
The ip command can also be used for other network management tasks, such as bringing interfaces up/down, setting IP addresses manually, and viewing routing tables.
3. ifconfig Command
The ifconfig command is a legacy tool previously used to configure and display network information. However, it is less used now because of the ip command. Still, today, it is one way to get your network configuration details, including IP addresses, netmasks, hardware (MAC) addresses, and more. You can also try it to configure network interfaces in some cases.
To get the IP address on the terminal type:
ifconfig
This command will show information about all your network connections. Look for the interface connected to your network (e.g., eth0, wlan0).
Identify the IP address from the output. It will be listed under inet addr (or IPv4 address).
While ifconfig is still functional, it’s considered a legacy tool. Modern Linux distributions recommend using the ip command for network interface management due to its improved capabilities and adherence to current network configuration standards.
4. nmcli Command
nmcli is another Linux command that manages network connections and displays network information. It allows you to interact with NetworkManager to handle networking on your Linux distributions.
To check the IP using nmcli command, run this:
nmcli device show
It will output all your system’s network devices and their IP addresses. This information mainly includes network device names, connection types (wired, wireless, etc.), and IP addresses.
To get the IP address, look for the line with a DEVICE type corresponding to your active network connection. It is usually enpXsY for wired or wlanX for wireless. Next, under the IP4 ADDRESS field, you’ll see the IP address.
For a more concise output, you can use the -p flag to specify which properties you want to see:
nmcli -p device show | grep IP4.ADDRESS
This command only shows the device name and IPv4 address. The nmcli command can also manage it.
5. networkctl command
The networkctl command is another Linux tool for managing the system information and viewing details about network connections. It’s specifically designed for systems systemd-networkd, a network management service in some distributions.
To use networkctl to check your IP address, first open the terminal and run:
networkctl status
This will display details about your active network connections, including the IP address. Look for the line mentioning IP Link or similar.
6. iftop command
iftop in Linux is a network traffic monitoring tool. It is similar to the top command, which shows CPU usage, but for network bandwidth. iftop won’t give you IP addresses directly, but it can help you identify which connections use the most bandwidth. By investigating those connections, you can track down the IP addresses involved.
iftop
7. From the GUI
The last method for checking the IP address is to use the file manager settings in your Ubuntu 24.04 system.
First, open your Ubuntu application menu and select Settings.
After that, go to Network Settings. Select the gear icon for network connection settings.
This will display your IPv4 and IPv6 addresses.
Conclusion
An IP address is your system network address that stores all your information, such as your location and the network provider service you are using. You can also use an IP address for the system to communicate with servers like NFS, which helps you create a local host and client system. To check the IP address in Linux, the most straightforward command you can use is ip a command. This will simply give you your system IP on the terminal. You can also explore other commands for getting IP or try the GUI method to get the IP address using the file manager settings.
Check our LinkedIn company page