Debian

List Network Interfaces in Debian 10

As a system administrator or a normal user, you often need to perform network configurations. Before doing so, you should know how many network interfaces are available in your system. This article will discuss various ways to list network interfaces in Debian systems.

The commands listed in this article were run using the command-line Terminal application. To launch the Terminal application in Debian, click the Activities tab in the top left corner of the desktop and type terminal in the search bar. When the search result appears, click on the Terminal icon to open the Terminal.

Note: All the commands discussed in this article have been executed with the Debian 10 Buster system.

Method #1: IP Command

The most common and easiest way to list network interfaces is by using the IP command. This command provides a wide array of information about your system’s network interfaces.

To list the network interfaces in your system, issue the following command in Terminal:

$ ip a

Or

$ ip addr

The above command lists all the network interfaces available in your system. The above output shows that there are three interfaces in the system: one loopback interface (lo) and two Ethernet interfaces (eth0 and eth1) are listed, along with other statistics. This command will also show some other useful information about the network interfaces, including IP address, status (UP or DOWN), MAC address, etc.

Note: You may have different network interface names based on your system’s hardware.

You can also use the following IP command to list the network interfaces:

$ ip link show

Method #2: ifconfig Command

The ifconfig command has now become obsolete but is still supported in many Linux distributions. You can use the ifconfig command to list the network interfaces available in your system.

Instead of typing ifconfig, type the command /sbin/ifconfig to list the network interfaces in your system.

$ /sbin/ifconfig

In addition to listing the network interfaces, the above command will show other useful information about the network interfaces, including IP address, MTU size, number of sent/received packets, etc.

Method #3: netstat Command

The netstat command can also be used to list the network interfaces available in your system. To do so, type netstat, followed by the -i flag, as follows:

$ netstat -i

The above command lists the available network interfaces in your system, along with other useful information, such as the number of sent received packets, MTU size, etc.

Method #4: nmcli Command

The nmcli command also provides information about network interfaces. The nmcli command is available with Debian distributions that are running on GUI interfaces. However, if you are working on a non-GUI system, you will need to install the network manager using the following command in Terminal:

$ sudo apt install network-manager

Once installation is complete, run the below commands in Terminal to enable and start the network manager:

$ sudo systemctl start network-manager
$ sudo systemctl enable network-manager

To list the available network interfaces in your system, run the below command in Terminal:

$ nmcli device status

The above command lists brief information about the available network interfaces.

Method #5: /sys/class/net Directory

You can also view network interfaces in your system by viewing the contents of the /sys/class/net directory. To do so, run the following command in Terminal:

$ ls /sys/class/net

The above command returns a concise output displaying only the names of the interfaces available in your system.

Method #6: /proc/net/dev File

The /proc/net/dev file also contains information about network interfaces. You can view the available network interfaces in your system by viewing the contents of this file. Run the following command in the Terminal to do so:

$ cat /proc/net/dev

The above command lists the network interfaces available in the system, along with some other information about the interfaces.

Conclusion

The great thing about Linux is that it allows you to perform the same job in different ways. This article discussed various methods through which you can list the network interfaces in your Debian system.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.