How to Display Available Network Interfaces in Linux

How to Display Available Network Interfaces in Linux

Understanding Linux network interfaces is vital for tasks like troubleshooting, network configuration, management, and optimization. Interfaces transmit data between a computer and network. By understanding how they work, users can enhance security and tailor the system to specific needs. This skill is foundational for both personal and business networks.

Listing of Network Interfaces in Linux

Here are some common ways to list available interfaces in Linux.

1. Using the ip Command. Displays the status and properties of all network interfaces. It’s a modern command for managing network settings and often preferred in current Linux distributions.

ip addr show

2. Using the nmcli Command.  ‘nmcli’  is a command-line client for NetworkManager, which is often used to manage network connections in modern Linux systems. This command displays the status of all network devices managed by NetworkManager.

nmcli device status

3. Listing the Contents of /sys/class/net Directory. This command lists the contents of the ‘/sys/class/net directory’, where information about all network interfaces is stored in the Linux kernel. It provides a straightforward way to see the names of all available interfaces.

ls /sys/class/net

4. Using the lshw Command. The ‘lshw’ (list hardware) command shows detailed information about the system’s hardware, and the ‘-class network’ option filters the output to only show network-related hardware. This command provides an in-depth view of the network interfaces, including physical details.

lshw -class network

5. Using the iwconfig Command.  Specifically for wireless interfaces, iwconfig displays information related to wireless networking.

iwconfig

6. Using the netstat Command. The ‘netstat’ command provides network statistics. The ‘-i’ option displays a table of all network interfaces.

netstat -i

7. Using the arp Command. The ‘arp’ command displays the Address Resolution Protocol (ARP) cache, which can provide information about network interfaces and IP address associations.

arp -a

8. Using the route Command.  Displays the routing table, which can provide information about network interfaces.

route -n

9. Using the ss Command.  Offers statistics related to network sockets, indirectly providing insight into network interfaces.

ss -s

10. Using the ifconfig Command. This might be deprecated in some modern distributions. Interface Configuration is an older command used to configure and display network interface parameters. The -a option shows all interfaces, even those that are down.

ifconfig -a

Understanding the various methods to display network interfaces in Linux is beneficial, whether you’re a casual user, a system administrator, or a software developer. This list of commands provides key insights into presenting available network connections within Linux.

Conclusion

Looking to deploy Linux in the cloud? With Gcore Cloud, you can choose from Basic VM, Virtual Instances, or VPS/VDS suitable for Linux:

Choose an instance

Subscribe to our newsletter

Stay informed about the latest updates, news, and insights.