Ubuntu Linux Display List of Ethernet Adapter

How do I display a list of all installed Ethernet adapters on Ubuntu Linux server using bash command line option?

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements Linux
Time 2m
You can use the following commands to list Ethernet adapters under Ubuntu Linux:
  1. lspci command – List all PCI device including Ethernet cards (NICs) on Linux.
  2. ip command – Display or manipulate routing, devices, policy routing and tunnels on Linux operating systems.
  3. ifconfig command – Display or configure a network interface on Linux or Unix like operating systems.
  4. lshw command – See hardware including list of Ethernet device on Linux.

Examples: Ubuntu Linux Display List of Ethernet Adapter

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to list total number of Ethernet devices on Linux:
$ lspci
$ lspci | less
$ lspci | grep -i eth

Sample outputs:

09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5761e Gigabit Ethernet PCIe (rev 10)

Above output indicates that my system has one Gigabit Ethernet controller installed using PCIe interface. It also displayed name of the manufacture. To list actual ip address assigned to the interface, enter:
$ ifconfig
$ ifconfig eth0

OR
$ /sbin/ifconfig
$ /sbin/ifconfig eth0

Sample outputs:

eth0      Link encap:Ethernet  HWaddr b8:ac:6f:65:31:e5  
          inet addr:192.168.2.11  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::baac:6fff:fe65:31e5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1938092 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2436052 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:771061372 (771.0 MB)  TX bytes:2118333235 (2.1 GB)
          Interrupt:17 

The eth0 is my Ethernet device with 192.168.2.11 IP address, 255.255.255.0 as the subnet mask, and b8:ac:6f:65:31:e5 as MAC address. On most modern Linux distro, we use the ip command as follows to list all NICs:
$ ip link
OR
$ ip -c link
Sample outputs:

Fig.01: Displaying ethernet devices

Alternatively, you can pass the -a (all) and -s (stats) option to the ifconfig command to display Ethernet cards including network alias on Linux operating systems:
$ ifconfig -s -a
Sample outputs:

Fig.02: ifconfig command in action

The last command “ifconfig -s -a” is equivalent to the “netstat -i” command:
$ netstat -i
Sample outputs:
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0  46686747      0      0 0      23678718      0      0      0 BMRU
eth1       1500 0   5951068      0      0 0       2412620      0      0      0 BMRU
lo        16436 0         1      0      0 0             1      0      0      0 LRU

Display or change Ethernet card settings

You can use the ethtool command for querying settings of an ethernet device and changing them such as speed, duplex settings and much more:
$ ethtool eth0
Sample outputs:

Settings for eth0:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Link partner advertised link modes:  Not reported
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: No
	Speed: 100Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: Unknown
	Supports Wake-on: g
	Wake-on: g
	Current message level: 0x000000ff (255)
	Link detected: yes

See how to change duplex settings with the ethtool command under Linux operating systems.

Say hello to lshw

To see hardware on Linux including network cards, run:
$ sudo lshw -short -c network
$ sudo lshw -c network

We will see it as follows:

H/W path               Device        Class          Description
===============================================================
/0/100/1d.6/0          wlp82s0       network        Wi-Fi 6 AX200
/0/100/1f.6            enp0s31f6     network        Ethernet Connection (7) I219-LM
/2                     virbr0-nic    network        Ethernet interface
/3                     virbr0        network        Ethernet interface
/4                     vethf5aa832e  network        Ethernet interface
/5                     vethc2f8aceb  network        Ethernet interface
/6                     br0           network        Ethernet interface
/7                     lxdbr0        network        Ethernet interface
/8                     vethde25600f  network        Ethernet interface

Wrapping up

You learned various Linux commands to list Ethernet devices on Linux. See man pages:

  • Man pages: ethtool(8)

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 5 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • arandom Sep 17, 2012 @ 17:14

    ifconfig -a -s

    • shgn Oct 20, 2013 @ 11:00

      Thank you. It was the exact solution of my problem.

    • 🐧 nixCraft Oct 20, 2013 @ 13:58

      The faq has been updated. I appreciate your feedback.

  • dawciobiel Nov 13, 2015 @ 0:06

    lshw -c network

  • johns Apr 9, 2016 @ 19:32

    All the commands in here are >practically< useless especially if you consider that most of the visitors that will check this would be linux newbies….

    the command that does the job (= tells you the chipset,what it does were its connected,what is its logical name etcetc) is:

    lshw -c network

    everything else in here just is either practically useless or will confuse the newbie…

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz