How do I display a list of all network cards under Linux operating systems?
You can use any one of the following command to list network cards installed under Linux operating systems. Please note that the ifconfig and ip commands will also display interfaces information about vpn, loopback, and other configured interfaces.
- lspci command : List all PCI devices.
- lshw command : List all hardware.
- dmidecode command : List all hardware data from BIOS.
- ifconfig command : Outdated network config utility.
- ip command : Recommended new network config utility.
- hwinfo command : Probe Linux for network cards.
- ethtool command : See NIC/card driver and settings on Linux.
We use standard terms, such as the network interface controller (NIC). Also known as a network interface card, network adapter, LAN adapter or physical network interface, and so on. Let us see some useful examples for displing out NIC info on Linux.
Use lspci command Linux command to show list of network cards
Type the following lspci command along with egrep command to filter out devices:# lspci | egrep -i --color 'network|ethernet'
# lspci | egrep -i --color 'network|ethernet|wireless|wi-fi'
Sample outputs from my Linux server:
09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5761e Gigabit Ethernet PCIe (rev 10) 0c:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300
How to use lshw command for displaying network cards (NIC) on Linux
The lshw command can extract detailed information on the hardware configuration of the machine including network cards. Type the following command:# lshw -class network
Detailed hardware information about network cards on Linux:
*-network DISABLED description: Wireless interface product: Ultimate N WiFi Link 5300 vendor: Intel Corporation physical id: 0 bus info: pci@0000:0c:00.0 logical name: wlan0 version: 00 serial: 00:21:6a:ca:9b:10 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=3.2.0-0.bpo.1-amd64 firmware=8.83.5.1 build 33692 latency=0 link=no multicast=yes wireless=IEEE 802.11abgn resources: irq:46 memory:f1ffe000-f1ffffff *-network description: Ethernet interface product: NetXtreme BCM5761e Gigabit Ethernet PCIe vendor: Broadcom Corporation physical id: 0 bus info: pci@0000:09:00.0 logical name: eth0 version: 10 serial: b8:ac:6f:65:31:e5 size: 1GB/s capacity: 1GB/s width: 64 bits clock: 33MHz capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.121 duplex=full firmware=5761e-v3.71 ip=192.168.1.5 latency=0 link=yes multicast=yes port=twisted pair speed=1GB/s resources: irq:48 memory:f1be0000-f1beffff memory:f1bf0000-f1bfffff
Here is another outputs:
$ sudo lshw -class network -short H/W path Device Class Description =========================================================== /0/100/1d.6/0 wlp82s0 network Wi-Fi 6 AX200 /0/100/1f.6 eth0 network Ethernet Connection (7) I219-LM
Where,
- -class network : View all network cards on your Linux system
- -short : Display device tree showing hardware paths, very much like the output of HP-UX’s ioscan
Let us see mask, IP and other information set up for wlp82s0:$ ip a show wlp82s0
Linux ethtool command for Ethernet hardware devices
Want to see/query or control network driver and hardware settings on Linux? Try the the ethtool command:$ sudo ethtool enp0s31f6
And it spitted out tons of useful information for my Ethernet network card on Linux:
Settings for enp0s31f6: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on MDI-X: off (auto) Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: yes
We can display driver information for network card too:$ sudo ethtool -i eth0
$ sudo ethtool -i enp0s31f6
ifconfig and ip commands
To see all configured network devices, enter:# ifconfig -a
OR# ip link show
OR# ip a
Sample outputs:
1: lo: mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc mq state UP qlen 1000 link/ether b8:ac:6f:65:31:e5 brd ff:ff:ff:ff:ff:ff inet 192.168.1.5/24 brd 192.168.1.255 scope global eth0 inet6 fe80::baac:6fff:fe65:31e5/64 scope link valid_lft forever preferred_lft forever 3: wlan0: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:21:6a:ca:9b:10 brd ff:ff:ff:ff:ff:ff 4: pan0: mtu 1500 qdisc noop state DOWN link/ether 92:0a:e7:31:e0:83 brd ff:ff:ff:ff:ff:ff 5: vmnet1: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff inet 192.168.121.1/24 brd 192.168.121.255 scope global vmnet1 inet6 fe80::250:56ff:fec0:1/64 scope link valid_lft forever preferred_lft forever 6: vmnet8: mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff inet 192.168.179.1/24 brd 192.168.179.255 scope global vmnet8 inet6 fe80::250:56ff:fec0:8/64 scope link valid_lft forever preferred_lft forever

Want to list all IP addresses and interfaces on Linux in a tabular format for better readability? Try:$ ip -br -c link show
$ ip -br -c addr show
Listing network cards on Linux using hwinfo command
Open the terminal and then type:$ sudo hwinfo --network --short
network interface: veth4cf4e314 Ethernet network interface lxdbr0 Ethernet network interface veth5ac9105a Ethernet network interface veth0932715b Ethernet network interface veth514990e6 Ethernet network interface lo Loopback network interface eth0 Ethernet network interface veth844c4162 Ethernet network interface vethe8d69a5f Ethernet network interface
We can now obtain more info for eth0 using the ip command:$ ip a s eth0
My IP address assigned to eth0:
2: eth0: mtu 9001 qdisc mq state UP group default qlen 1000 link/ether 0a:99:85:fc:11:57 brd ff:ff:ff:ff:ff:ff inet 172.26.9.151/20 brd 172.26.15.255 scope global dynamic eth0 valid_lft 3501sec preferred_lft 3501sec inet6 fe80::899:85ff:fefc:1157/64 scope link valid_lft forever preferred_lft forever
The /proc/net/dev file
The dev pseudo-file contains network device status information. This gives the number of received and sent packets, the number of errors and collisions and other basic statistics. Open the terminal and then type the following cat command:$ cat /proc/net/dev
Stats:
Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 20097 179 0 0 0 0 0 0 20097 179 0 0 0 0 0 0 vmnet8: 0 0 0 0 0 0 0 0 0 33 0 0 0 0 0 0 pan0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 wlan0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eth0: 592509534 623058 0 0 0 0 0 1053 122269656 401567 0 0 0 0 0 0 vmnet1: 0 0 0 0 0 0 0 0 0 34 0 0 0 0 0 0
Conclusion
We learned about various Linux commands to display information about installed and running network cards.
Reference: https://www.cyberciti.biz/faq/linux-list-network-cards-command/
Comments are closed