How to List Network Interfaces on Debian 12

Network interfaces are computer hardware components that allow the machine to communicate with other devices. A common example of the network interface is the Wifi interface that is used for network communication using the Wifi interfaces. 

In computers regardless of the operating system installed on the computer, there is always the option to list down the computer’s network interfaces. In this post, various methods are discussed to list down the network interfaces of the computer on Debian 12. This blog will explain all the methods with the following outline:

  1. What are the Types of Network Interfaces
  2. Why is it Necessary to List Down the Network Interfaces
  3. What are the Methods to List Down the Network Interfaces on Debian 12
  4. Method 1: List Down the Network Interfaces Using the ifconfig Command
  5. Method 2: List Down the Network Interfaces Using the ip Command
  6. Method 3: List Down the Network Interfaces Using the netstat Command
  7. Method 4: List Down the Network Interfaces Using the lshw Command
  8. Method 5: List Down the Network Interfaces Using the nmcli Command
  9. Method 6: List Down the Network Interfaces Using the iwconfig Command
  10. Method 7: List Down the Network Interfaces Using the /sys/class/net Directory
  11. Method 8: List Down the Network Interfaces Using the /proc/net/dev File
  12. Method 9: List Down the Network Interfaces Using the tcpdump Command
  13. Method 10: List Down the Network Interfaces Using the inxi Command
  14. Method 11: List Down the Network Interfaces Using the hwinfo Command
  15. Method 12: List Down the Network Interfaces Using the Bash Script

Let’s start the post by understanding the types of Network Interfaces on Debian 12. 

What are the Types of Network Interfaces?

The network interfaces are the hardware components of the computer that are used to transfer data between two different devices. The important types of network interfaces in computers are discussed in the table below.

Network InterfaceDescription
WiFi InterfaceIt is used for communication through the WiFi connection and is denoted by wlan0, wlan1, and so on
Ethernet InterfaceIt is used for communication through the ethernet cable connected to the computer and is denoted by eth0 and eth1
Virtual InterfaceIt is used to connect with the virtual machines through the bridges and is denoted by virbr0
Loopback interfaceThis is the special network interface that is used for communication with the local machine and is denoted by the lo

After finding out different types of network interfaces, now it’s time to understand why they are important to list down on the machine. 

Why is it Necessary to List Down the Network Interfaces?

It is important to list down the network interfaces during the management of the network connections and administrative tasks. The practical reasons for listing down the network interfaces are explained below:

  • To identify the connected devices with the computer and also for their configuration
  • In troubleshooting, first list down the network connections and then find the status of the connections
  • For the security of the computer, list down the networks for configuring firewalls
  • To keep track of the network usage by listing down the networks
  • Also, the networks are listed down for regular maintenance purposes

Because of the mentioned reasons, network interfaces are supposed to be listed on the Debian 12 following the methods explained in this next section. 

What are the Methods to List Down the Network Interfaces on Debian 12?

On Debian 12, different methods can be used to list down the network interfaces. All these methods are explained in this section.

Method 1: List Down the Network Interfaces Using the ifconfig Command

The ifconfig command on Debian 12 is used to configure the network interfaces and it is also used to list down the network interfaces of the computer. To list down the network interfaces on Debian 12, open the terminal and run the command:

$ sudo ifconfig

In the above output, it has been displayed that the two network interfaces are available on the computer. One is the ethernet network interface that is represented with the “enp0s3” which means the ethernet network connection is connected with port 0 and slot number 3. 

Another network connection is of loopback interface that has been represented by the lo. Both network interfaces are displayed with their complete information including the packet details. 

Note: If the command is not found on Debian 12, then run the below-mentioned command for the installation of the net-tools:

$ sudo apt install net-tools -y

The net-tools package will install the “ifconfig” command utility as well on Debian 12. To learn more usage of the ifconfig command, go through the mentioned blog.

Method 2: List Down the Network Interfaces Using the ip Command

Another method of listing down the network interfaces on Debian 12 is by using the ip command whereas the ip command is the modern command utility that comes in the new releases of Linux including Debian 12 for the configuration of the network interfaces. 

To list down the network interfaces on Debian 12, run the command:

$ sudo ip a

The output displays the two available network interfaces on Debian 12. It also provides the details of the packets and IP address information. To display only the connected network devices on the computer, run the command with its “link” option:

$ sudo ip link

The network devices connected to the computer have been displayed on the screen. 

Method 3: List Down the Network Interfaces Using the netstat Command

The netstat is also the command utility on Debian 12 that is used to list down and configure the network interfaces. To use the netstat command on Debian 12 for listing down the network interfaces, run the command:

$ netstat -i

The “i” option of the netstat command is being used and it has displayed the connected network interfaces on Debian 12. To explore more about the installation and usage of the netstat command in Debian 12, visit the mentioned blog

Method 4: List Down the Network Interfaces Using the lshw Command

The lshw is the command to list down the information of the hardware on Debian 12. The lshw command does not come pre-installed on Debian 12, but it can be installed by running the command:

$ sudo apt install lshw -y

After installing the lshw command on Debian 12, display the information of the network interfaces only by running the command:

$ sudo lshw -class network

The network interfaces have been displayed on the screen with the complete details. The details also contain the hardware specifications including the vendor name, logical name, and size. 

Method 5: List Down the Network Interfaces Using the nmcli Command

The nmcli command is used for controlling and managing the network manager on Debian 12. It is also used to create, delete, activate, and deactivate network connections. 

To display the network interfaces on Debian 12 using the nmcli command, run the command with its “dev” option:

$ sudo nmcli dev

The internet interfaces have been explained on Debian 12 as seen on the output. 

Method 6: List Down the Network Interfaces Using the iwconfig Command

The iwconfig command is used to list down all the wireless interfaces connected to the computer. To use the iwconfig for displaying all the connected wireless network interfaces, run the command:

$ sudo iwconfig

There are no wireless network interfaces that have been connected as shown on the screen. 

Method 7: List Down the Network Interface Using the /sys/class/net Directory

To display the names of the connected network interfaces on Debian 12, display the contents of the /sys/class/net directory. To display the contents of the /sys/class/net on Debian 12, use the ls command:

$ ls /sys/class/net

The network interface names can be seen in the output of the above-executed command. 

Method 8: List Down the Network Interfaces Using the /proc/net/dev File

Similar to the previous method, the/proc/net/dev file also contains the information of the network interfaces. To display the information in the /proc/net/dev file, use the cat command as shown:

$ cat /proc/net/dev

The output displayed the information of the connected network interfaces on the Debian 12. 

Method 9: List Down the Network Interfaces Using the tcpdump Command

The tcpdump command in Linux is used to display the dump traffic on the network. It can also be used to view the network interfaces on Debian. To use the tcpdump command, install it with the following command:

$ sudo apt install tcpdump -y

After the installation of the tcpdump command on Debian 12, run it to display the network interfaces:

$ tcpdump

To display only the network interfaces with the tcpdump command, execute the command:

$ sudo tcpdump --list-interfaces

All the connected network interfaces connected to the computer are displayed on the screen as it can be seen in the output. 

Method 10: List Down the Network Interfaces Using the inxi Command

The inxi command is also the command to display the information of the hardware of the computer using the Debian 12. To install the inxi command on Debian 12, run the command:

$ sudo apt install inxi -y

When the installation is completed then run the command with its “N” option to display the connected network interfaces:

$ sudo inxi -N

It has displayed the information on the connected network hardware. 

Method 11: List Down the Network Interfaces Using the hwinfo Command

The last command on Debian 12 that can be used to display the information of the hardware is hwinfo command. This hwinfo command can be installed by running the command:

$ sudo apt install hwinfo -y

When the installation of the command is completed, run the hwinfo command with the “netcard” option to display the information of the available network cards:

$ sudo hwinfo --short --netcard

The information on the network card on the Debian 12 installed computer has been displayed on the screen. 

Method 12: List Down the Network Interfaces Using the Bash Script

The bash script can also be used to list down the network interfaces on the computer having a Debian 12 OS installed. For this purpose, first create the file with the “sh” extension using the nano text editor:

$ nano ListNetworkInterfaces.sh

Now copy and paste the below bash script:

list=$(find /sys/class/net -type l)
for nic in $list
do
    echo "*** [ Network Interface Name: $nic ] ***"
    cat "${nic}/uevent"
    echo ""
done

Save the file with the CTRL+S and exit the nano text editor using the CTRL+X shortcut key,then run the bash script with the following command:

$ bash ListNetworkInterfaces.sh

The network interfaces have been explained in the output. The explanation of the bash script is that the names of the network interfaces have been extracted from the /sys/class/net directory and stored in the $list variable. Finally, with the help of the echo command, the output has been displayed in the for loop. 

All these methods can be used to list down the network interfaces on Debian 12 using the terminal. 

Conclusion

To list down the network interfaces on Debian 12, twelve different methods including the ip, ifconfig, iwconfig, nmcli, and netstat commands have been explained. Some hardware commands including the hwinfo, lshw, and inxi commands have been also used to list down the network interfaces. All these twelve methods for listing down the network interfaces have been explained in this blog. 

This listing will be helpful in monitoring and managing the network connections on Debian 12.