How to List Network Interfaces in Linux

list network interfaces linux

As a Linux user, you might need to know the network interfaces available on your system. Network interfaces are the physical or virtual devices used by the Linux operating system to communicate on the network. These interfaces are commonly used for activities such as connecting to the internet, transferring files, and more.

In this article, we will explore how to list network interfaces in Linux. We will also explain some related concepts and methods that can help you understand this topic better.

Using the ifconfig Command

The ifconfig command is a popular tool used to configure network interfaces in Linux. It can also be used to list the available network interfaces on a Linux system. To use the ifconfig command, follow these steps:

  1. Open the terminal on your Linux system.
  2. Type ifconfig and press Enter. This will display a list of network interfaces currently available on your system.
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
        inet6 fe80::f816:3eff:fe45:5ce5 prefixlen 64 scopeid 0x20<link>
        ether fa:16:3e:45:5c:e5 txqueuelen 1000 (Ethernet)
        RX packets 22145 bytes 2793611 (2.7 MB)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 12907 bytes 1699373 (1.6 MB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
        inet 127.0.0.1 netmask 255.0.0.0
        inet6 ::1 prefixlen 128 scopeid 0x10<host>
        loop txqueuelen 1000 (Local Loopback)
        RX packets 131 bytes 10915 (10.9 KB)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 131 bytes 10915 (10.9 KB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

As you can see from the output above, the ifconfig command lists all available network interfaces on the system. In this example, we have two network interfaces: eth0 and lo.

The eth0 interface is a physical Ethernet interface, while the lo interface is a loopback interface that allows a network interface to communicate with itself.

Using the ip Command

Another way to list network interfaces in Linux is to use the ip command. The ip command is a powerful tool that can be used to manage network interfaces, routing tables, and more. To use the ip command to list network interfaces, follow these steps:

  1. Open the terminal on your Linux system.
  2. Type ip link show and press Enter. This will display a list of network interfaces currently available on your system.
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether fa:16:3e:45:5c:e5 brd ff:ff:ff:ff:ff:ff

As you can see from the output above, the ip command lists all available network interfaces on the system. In this example, we have two network interfaces: lo and eth0.

The lo interface is a loopback interface, while the eth0 interface is a physical Ethernet interface.

Conclusion

In this article, we have explored how to list network interfaces in Linux using the ifconfig and ip commands. We have also explained some related concepts and methods that can help you understand this topic better.

Knowing how to list network interfaces on your Linux system can be useful for troubleshooting network issues, configuring network settings, and more. We hope that this article has been helpful in guiding you through the process of listing network interfaces in Linux.