5 Commands to list IP Address Information on Ubuntu

If you are using a Linux distro without a graphical interface then to find the IP address you have to use the command line interface. Here in this article, we learn the multiple commands that can be used to get information about networking configuration. Finding IP address details can be beneficial in networking configuration and troubleshooting purposes.

Few popular commands to obtain IP Address information on Linux servers or desktops.

1. ip addr

The most common command to display network adapter information is “IP addr” on the Linux system. When we execute it without supplying any extra arguments, the command will show the IP address, netmask, gateway, physical address of the adapter, and other details…

To use it, run the given command in your Terminal:

ip addr
ip addr command

2. ifconfig

Although “ifconfig” is a common command and traditional utility, many modern Linux distros would not have it by default and users need to install it manually. Like “ip addr” this one can also be used to display IP address information for all active network interfaces.

ifconfig
ifconfig command

3. hostname -I

Those who don’t want detailed info about their Linux system network interfaces, instead of only the IP addresses assigned to them on the system, can use the hostname command with the “-I” option. This command provides a simple list of IP addresses assigned to all network interfaces on the system.

hostname -I
hostname command to get IP address

4. nmcli

Linux systems users with GUI can also use the Network Manager’s “nmcli” command which offers a powerful interface for managing network connections. Unlike other commands, “nmcli” gives well-detailed and structured information about the network interfaces of the system including their IP addresses, here is the command to follow, you can use it without any parameter as well.

nmcli device show
nmcli device show command

Note: Those who don’t have “Network Manager” and if you like its way of showing the details, install it manually. For example in Ubuntu or Debian, use the command – “sudo apt install network-manager” to install it.

nmcli command

5. ip route

The last command that we discuss in this article is “ip route” used to display the kernel’s IP routing table. It shows the routes the system learns, including the destination network, gateway, and interface used for forwarding packets.

ip route

Although, the output of the “IP route” command will also have the private address of the PC as well, however, if you want to list only it rather than routing details use the command in the following way:

ip route get 1.2.3.4 | awk '{print $7}'
ip route command to find ipaddress

Conclusion

So, we have seen how we can use the commands like “ip addr“, “ifconfig“, “hostname“, “nmcli“, and “ip route“, to quickly find the details of our network interfaces on Linux-running devices. Also, it is better to run these commands with Admin rights i.e. using ‘sudo’ to access restricted network information and make configuration changes when necessary.

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.