How to check network adapter status in Linux

last updated in Categories , , , , , ,

I am a new Linux system user. How can I check the physical status of an Ethernet port in Linux command line? How do I check network adapter status in Linux?

Linux comes with various command line utilities to dig information about network adapters such as Ethernet, WiFi and other installed in your system. This page shows how to find network adapter status in Linux using bash or any other modern shell.

Command to check network adapter names in Linux

Open the Terminal application and type the following command to see all network device names and other info:
sudo lshw -class network -short
Sample outputs:

H/W path       Device      Class          Description
=====================================================
/0/100/1c/0    wlp1s0      network        Wireless 8265 / 8275
/0/100/1f.6    eno1        network        Ethernet Connection I219-LM
/2             virbr0-nic  network        Ethernet interface
/3             virbr0      network        Ethernet interface

So wlp1s0 is my Wireless and eno1 is my Ethernet Connection.

Getting IP address and other information

Simply use the ip command as follows:

ip a
ip a s {device}
ip a s eno1
ip a s wlp1s0

Linux check network adapter status command
The above command indicates that my Ethernet is up and running with 192.168.2.24/24 IP address. It also displayed my mac address 40:9f:38:28:f6:b5.

How to query or control network driver and hardware settings in Linux

For wired Ethernet devices, you need to use a command called ethtool. It provides the following information from the Linux CLI

  1. Display info about network adapter status
  2. Find identification and diagnostic information
  3. Get extended device statistics
  4. Set or get speed, duplex, autonegotiation and flow control for Ethernet devices
  5. Control checksum offload and other hardware offload features
  6. Update or set DMA ring sizes and interrupt moderation
  7. Control receive queue selection for multiqueue devices
  8. Upgrade firmware in flash memory

Display the physical status of an Ethernet port in Linux

The syntax is:
sudo ethtool {device}
sudo ethtool [option] {device}

For example, get info about eno1 Ethernet device:
sudo ethtool eno1
Sample outputs:

Settings for eno1:
	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: on (auto)
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes

See network device driver information

Run:
sudo ethtool -i eno1
Linux Check The State Of A Network Interface Card

Is eno1 Ethernet device is up or down?

Run the following cat command:
cat /sys/class/net/eno1/carrier
cat /sys/class/net/eno1/operstate

Another option is use the ip command along with grep command/egrep command:
ip a s eno1 | grep state
OR
sudo ethtool eno1 | grep -i 'Link det'
OR
nmcli device status

Various command to check your network connections on Linux

A note abou Find Wireless Wifi Driver Chipset Informationt checking Wireless network adapter status in Linux

To find Wireless (Wifi) driver chipset information on Linux, run:
lspci | less
lspci | grep -i intel
lspci | grep -i broadcom
lspci | grep -i wireless
lshw -C network | grep -B 1 -A 12 'Wireless interface'

Sample outputs:

  *-network DISABLED        
       description: Wireless interface
       product: Wireless 8265 / 8275
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: wlp1s0
       version: 78
       serial: 2e:9c:fd:d8:a1:0d
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=5.0.5-200.fc29.x86_64 firmware=36.9f0a2d68.0 latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:129 memory:df000000-df001fff

Run wavemon command to find out Wireless network speed, signal Strength and other information from the CLI:
wavemon
Linux find wireless network card status command

Conclusion

This page showed various Linux command for controlling network drivers and hardware, particularly for wired Ethernet devices.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive