How to List Network Interfaces in Linux?
Last Updated :
01 Feb, 2024
In Linux, a Network Interface serves as the communication link between a computer and a network. It is a crucial component that enables the transmission and reception of data between the system and external networks, such as the Internet or local area networks. Each network interface is associated with a unique identifier, often referred to as the interface name (e.g., eth0 or wlan0), and is configured with specific settings like IP addresses, subnet masks, and gateway information. Linux supports a variety of network interface types, including Ethernet, Wi-Fi, and virtual interfaces, allowing users to establish and manage connections seamlessly. In this article, we will explore 10 different methods through which we can list all network interfaces in the Linux Operating System.
How to list network interfaces in Linux?
Below we have listed all the 10 methods through which we can list network interfaces on Linux OS:
We will see each of the methods with its implementation.
Using ip command to list network interfaces in Linux
In this method, you can use the "ip" command to list network interfaces in Linux. Open a terminal and type the following command:
ip addr
Using ip command
This command displays a list of network interfaces along with their corresponding details, such as the interface name, state, and hardware address. The "ip" command provides extensive network configuration and information capabilities in Linux.
Using nmcli to list network interfaces in Linux
In this method, you can utilize the "nmcli" (NetworkManager Command-Line Interface) tool to list network interfaces in Linux. Execute the following command in the terminal:
nmcli device status
Using nmcli
This command provides an overview of network interfaces managed by NetworkManager, including details such as device type, state, connection status, and associated IP addresses.
Using netstat to list network interfaces in Linux
In this method, the "netstat" command with the "-i" option can be used to list network interfaces in Linux. Execute the following command in the terminal:
netstat -i
Using netstat
This command displays a table of network interfaces along with their respective transmission and reception statistics, such as bytes and packets.
Using ifconfig command to list network interfaces in Linux
In this method, you can use the "ifconfig" command to list network interfaces in Linux. Simply execute the following command in the terminal:
ifconfig
Using ifconfig command
This command displays a detailed output that includes information about all active network interfaces, such as the interface name, hardware address, IP address, and other configuration details.
Printing /proc/net/dev file to list network interfaces in Linux
In this method, you can print the contents of the "/proc/net/dev" file to list network interfaces in Linux. Execute the following command in the terminal:
cat /proc/net/dev
Printing /proc/net/dev file
This command displays a detailed table of network interfaces along with statistics like received and transmitted bytes and packets. The "/proc/net/dev" file is a virtual file that provides kernel-level information about network devices.
Listing /sys/class/net/ directory to list network interfaces in Linux
In this method, you can list network interfaces in Linux by examining the contents of the "/sys/class/net/" directory. Execute the following command in the terminal:
ls /sys/class/net/
Listing /sys/class/net/ directory
This command provides a simple list of network interface names present in the "/sys/class/net/" directory. Each entry corresponds to a network interface, such as Ethernet or wireless devices.
Using hwinfo command to list network interfaces in Linux
In this method, the "hwinfo" command with the "--short" and "--network" options are used to list network interfaces in Linux. Execute the following command in the terminal:
sudo hwinfo --short --network
Using hwinfo command
This command provides a summary of hardware information related to network devices. By using "hwinfo," users can obtain detailed information about their network interfaces, including the interface names, driver details, and configuration.
Using lshw command to list network interfaces in Linux
In this method, the "lshw" command with the "-class network" and "-short" options are used to list network interfaces in Linux. Execute the following command in the terminal:
sudo lshw -class network -short
Using lshw command
This command provides a summary of network-related hardware information, including network interface names, descriptions, and driver information. The use of "sudo" may be required to ensure sufficient privileges for accessing hardware information.
Using iwconfig to list network interfaces in Linux
In this method, the "iwconfig" command is used to list wireless network interfaces in Linux. Execute the following command in the terminal:
iwconfig
Using iwconfig
This command specifically focuses on wireless interfaces and provides information about their configuration, including details like the interface name, the ESSID (Extended Service Set Identifier), access point MAC address, signal strength, and more.
Using lspci command to list network interfaces in Linux
In this method, the "lspci" command with the pipe and "egrep" combination is used to list network-related devices in Linux. Execute the following command in the terminal:
lspci | egrep -i 'network|ethernet|wireless|wi-fi'
Using lspci command
This command filters the output of "lspci" to display only the lines containing keywords such as 'network,' 'ethernet,' 'wireless,' or 'wi-fi.' The result is a concise list of PCI devices related to networking, making it easier to identify network interfaces and associated hardware on the system.
Conclusion
In conclusion, users can list network interfaces through various methods. Common commands like "ip link show," "nmcli device show," "ifconfig," and "netstat -i" provide detailed information. Additionally, examining directories such as "/proc/net/dev" and "/sys/class/net/" offers direct insights. Tools like "lshw," "iwconfig," and "lspci" cater to specific needs, showcasing hardware details. Each method serves as a valuable resource for users to efficiently retrieve network interface information based on their preferences and requirements.
Similar Reads
How to Install a Network Interface Card?
Network Interface Card is a very useful hardware component for computers. This component is only applicable to computers. This card can not be applied to laptops. There are two types of internet connection. In one case, using Wi-Fi, we can browse the web servers. In another case, we have to use a wi
6 min read
How to Put WiFi Interface into Monitor Mode in Linux?
Before looking into Monitor mode and how to switch your WiFi mode from Managed to Monitor, itâs important to understand how a basic WiFi connection is established. When your system connects to WiFi, it sends packets to the WiFi network, which in turn acknowledges these packets, establishing a connec
4 min read
How to Install nload in Linux?
nload is a console-based application which monitors network traffic and bandwidth usage in real. It provides information about incoming and outgoing traffic using graphs, and additionally it provides information like current data transferring rate average data transferred, and minimum and maximum da
3 min read
How to configure network interfaces in CentOS?
A network interface is a link between a computer and another network(Private or Public). The network interface is basically a card which is known as NIC or Network Interface Card, this does not necessarily have to be in a physical form instead, it can be inbuilt into the software. If we take the exa
5 min read
Interface (NICs) Bonding in Linux using nmcli
A network interface card (NIC) is a hardware component that connects computers over a network. This is a circuit board attached to your computer that provides a dedicated network connection for your computer. Also called a network interface controller, network adapter, or LAN adapter. A NIC provides
5 min read
What is Switch Command-Line Interface?
Network devices communicate with each other efficiently with the help of switches. For the management of network devices, we use different types of configuration methods to configure switches and manage their information flow, sharing, and resource allocation. The command line interface is one of th
4 min read
Linux iftop - Listen Network Traffic and Bandwidth
The iftop listens to network traffic on a specified network interface. The iftop is a perfect tool for remote Linux server over a ssh based session.iftop displays the bandwidth usage by a pair of hosts in the form of a table. To run this tool we must have superuser (root)permissions. Installation: I
3 min read
Network Tool in Microsoft Edge Browser
The Network Tool is used to view the various network request and corresponding responses of the web page. It provides various types of information about the request such as hearde, payload and initiator. You are also allowed to set various network conditions or filter in the requests or set network
5 min read
How to Install python-nmap Library on Linux?
Python-Nmap is a network mapper that is exceptionally vital in handling security auditing and discovering the network. It exists as an open-source project; thus it is available for free. All the core operating systems support Python-Nmap. However, the binary packages are only available for Windows,
5 min read
Linux Network Commands Cheat Sheet
Linux is a very popular operating system. Many people use it. Developers and network admins need to know Linux network commands well. This article will going explains most of the common Linux network commands in a very easy way and It also has a cheat sheet about these commands. The cheat sheet tell
9 min read