List Network Interfaces in Ubuntu
How To

List Network Interfaces in Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

The network interface is nothing but a software component, usually implemented in the kernel, and allows you to communicate using the network hardware. They could be Ethernet, Wireless, Bluetooth etc.

In this tutorial, I will walk you through multiple ways to list the network interfaces along with their details in Ubuntu.

1. Using the ip command

Being one of the most basic networking commands, the ip command is used to find the IP address and manage networks in Linux.

And to list the network interfaces using the ip command, all you have to do is execute the ip command with the link and the show option as shown:

ip link show
list network interfaces in ubuntu using the ip command in ubuntu

And as you can see, the ip command gave me the names of all six network interfaces, the MAC addresses, current status, and other information.

2. Using the nmcli command

The nmcli command in Linux is used to manage networks when your distro is utilizing the NetworkManager service and most of the distros do ship with it.

So to list the network interface, all you have to do is execute the following command:

nmcli device status
list network interfaces using the nmcli command

Pretty clean output. Isn't it?

3. Using the netstat command

The netstat command is mainly used by system admins to monitor the network but it can also be used to list the network interfaces.

To use the netstat command to list the network interfaces, you'd have to use the following command:

netstat -i
use netstat command to list the network interfaces in ubuntu

And as you can see, apart from listing the network interfaces, it gives tonnes of additional information so here's a brief explanation of each column:

  • MTU: shows the largest packet size that can be transmitted over the network.
  • RX-OK: indicates the number of packages received successfully by an interface.
  • RX-ERR: shows the number of packets received with an error.
  • RX-DRP: number of packets that were dropped while receiving because the buffer was full.
  • RX-OVR: number of packets that were dropped while receiving because the buffer was overflowed.
  • TX-OK: shows the number of packets transmitted successfully over the network.
  • TX-ERR: indicates the number of packets that were not transmitted successfully.
  • TX-DRP: number of packets that were dropped while transmission because of the buffer was full.
  • RX-OVR: number of packets that were dropped while transmission because of buffer overflow.
  • Flg: it shows the flag associated with the network.

4. Using the ifconfig command

The ifconfig command is one of the most popular CLI tools which is used to monitor, configure and troubleshoot the network in Linux.

And when executed without any options, the ifconfig command brings all the basic details of the network interfaces:

ifconfig
use the ifconfig command to list the network interfaces in linux

Got an error saying ifconfig command not found? Here's an easy solution to get away from the error:

ifconfig command not found? Install it on Ubuntu
The ifconfig utility is being deprecated in favor of the new ip commands. However, it is still widely used and hence still available to install in Ubuntu

5. By listing the contents of /sys/class/net

The ls /sys/class/net is a directory where you'd find the directory for each network interface.

This makes it the easiest method in the whole tutorial but the only downside is you don't get any additional information apart from the name of the interface.

Here, I will use the ls command to list the directories in the following manner:

ls /sys/class/net/
list network interfaces in Ubuntu

Bonus Tip: Know the brand of the interface

The above commands do not tell you if your wireless adapter is by Atheros or Broadcom or some other brand.

You can list the make of the network adapters by using the lshw command. This command is used for getting the hardware details of your Linux system.

To get the network interface details, use it like this:

lshw -C network
List network interface in Ubuntu with lshw command

Just getting started? Know the basics first

If you are just getting started with networking, knowing the basic commands is the most crucial thing.

So for that purpose, we have compiled a list of the most basic networking commands including their examples:

21 Basic Linux Networking Commands You Should Know
A list of basic Linux networking commands that will help you troubleshoot network issues, monitor packets, connect devices, and much more.

I hope you will find this guide helpful. And if you have any queries, feel free to ask in the comments.



Sagar Sharma

Sagar Sharma

A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.