Linux show network devices

How to check network adapter status in Linux

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:

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

Getting IP address and other information

Simply use the ip command as follows:

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
sudo ethtool [option]
For example, get info about eno1 Ethernet device:
sudo ethtool eno1
Sample outputs:

See network device driver information

Run:
sudo ethtool -i eno1

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:

Источник

Ubuntu Linux Display List of Ethernet Adapter

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

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux
Est. reading 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:

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:

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

Fig.02: ifconfig command in action

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:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

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:

Wrapping up

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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

List network interfaces on Linux

The network configuration is a common place to start during system configuration, security audits, and troubleshooting. It can reveal useful information like MAC and IP addresses. This guide helps you to gather this information on Linux, including listing all available network interfaces and its details.

Table of Contents

Show network interfaces

Linux

Every Linux distribution is using its own way of configuring the network configuration details. Therefore, it is good to know which tools can be used to query these details in a generic way. So these commands should be working on the popular distributions like Arch Linux, CentOS, Debian, Gentoo, RHEL, and Ubuntu.

The old way: ifconfig

Previously the most obvious command to obtain the available network interfaces was using the ifconfig command. As some systems no longer have that command installed by default, we will also look at using alternative ip. If you still have ifconfig available, run it with the -a parameter.

Depending on what particular information you need, you can use grep to get you the right lines. The ifconfig command on Linux actually has the most option available, so have a look at the man page for all details.

Modern version: using the ip command

Newer Linux distributions now ship only the ip command. It is advised to start using this command instead of ifconfig, as its output works better with newer machines. Especially when using containerized applications, dynamic routing, and network aliases.

The easiest way to see what network interfaces are available is by showing the available links.

Linux network interfaces with ip link show command

Another option to show available network interfaces is by using netstat.

Note: the column command is optional, but provides a friendlier output for the eye.

Show the default gateway

The default gateway is the system that receives traffic for networks outside your own. On Linux systems, this gateway is typically received via DHCP or manually configured in a text configuration file.

Using the ip command

The output may look like this:

With netstat

The default gateway can be listed with the netstat command.

The output will be something like this:

The second column shows the gateway. When it lists an asterisk (*), it means it uses the default gateway.

AIX and Solaris

These two old style platforms have of course ifconfig still available. By using the -a parameter, all interfaces will be displayed.

To see only the interfaces which are active, add the -u (up) parameter.

DragonBSD, FreeBSD, NetBSD

On the systems running BSD, it is also the ifconfig tool that can be used.

Frequently Asked Questions

How can I see the MTU of an interface?

Use the ip show link command.

What command can I use to display the default gateway on Linux?

Use the ip route command to show routing information, including the default gateway and the network interface it uses.

How can I test if my network configuration is correct?

Test if you can reach or access both devices on your network as outside of it. This way you know that your IP address and gateway is correctly set up. If you can only access remote systems by IP address, then check your name server configuration, typically stored in /etc/resolv.conf. Another useful tool to test your system, including your network configuration, is by using auditing tool Lynis. It will test for connectivity of the name servers and retrieves the most important parts of the network settings.

Did this article help you? Become part of the community and share it on your favorite website or social media. Do you have additional tips regarding the network configuration on Linux? Share it in the comments!

Keep learning

So you are interested in Linux security? Join the Linux Security Expert training program, a practical and lab-based training ground. For those who want to become (or stay) a Linux security expert.

Run automated security scans and increase your defenses. Lynis is an open source security tool to perform in-depth audits. It helps with system hardening, vulnerability discovery, and compliance.

Источник

HowTo: Linux Show List Of Network Cards

H ow 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.

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux
Est. reading time 2m
  1. lspci command : List all PCI devices.
  2. lshw command : List all hardware.
  3. dmidecode command : List all hardware data from BIOS.
  4. ifconfig command : Outdated network config utility.
  5. ip command : Recommended new network config utility.
  6. hwinfo command : Probe Linux for network cards.
  7. 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:

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:

Here is another outputs:

  1. -class network : View all network cards on your Linux system
  2. -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:

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:

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

We can now obtain more info for eth0 using the ip command:
$ ip a s eth0
My IP address assigned to eth0:

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:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Conclusion

We learned about various Linux commands to display information about installed and running network cards.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

In which distro are you using the ip command? I’m trying it in Ubuntu and it seems to be a command to manipulate routing

@Chex, thanks! On Ubuntu, I was getting an error trying to run ‘ip -a’, but your command worked — and it’s very useful info.

It was a typo on part.

However, ip link show should be used.

For wireless cards I find “iwconfig” useful. I used to have problems with a wireless adapter going offline, which I worked around with “iwconfig wlan0 power off” to turn off its power management feature.

It would be most useful to correlate the HW info to the logical device name, such as the Broadcom NIC is eth1.

Try ethtool or lspci it will map both along with driver name:

Writing a shell script left as an exercise for the reader.

At any point is this site going to post anything that isn’t basic common knowledge to any linux users that isnt a complete noob?

Because if not, then I’m going to unsubscribe from your RSS feed.

I can not stop you or anyone else from unsubscribing to our RSS feed. The /faq/ section is for new users only so it has all sort of questions and answers. As you may have noticed that I’ve already started to display the difficulty level for each Q & A. I’m also working on rss feed for all three difficulties. So that users can only subscribe as follows:

  • Easy – for beginners.
  • Moderate – for Intermediate users.
  • Hard – for Advanced users.

This is going to take a little more time as need some sort of coding and modification on my part. Hope this helps.

ok, so idioms for the easy/intermediate/hard would be ubuntu/debian/all others? ^^

Nah, but linux is no longer for those who actually are bothered to learn how to use a computer (as opposed to the in ‘noob-land’), learn how to use windows. Now, many of the windows users who are just ‘end users’ and not computer savvy, migrate to linux, and will inadvertedly land on ubuntu like distros.

I recall on youtube, some user saying, I have been using Ubuntu for 6 months and consider myself fairly knowledgable, and then went on about DE if they are installable in other distros and what not. I don’t even know what it was, but it was so absurd, I am glad that person uttered Ubuntu and not linux, as clearly the person was clueless in the latter.

You can blame Canonical for such issue. Just visit http://www.ubuntu.com/desktop home page and try to find out word Linux. I think they are ashamed of using word Linux.

PS: I use Debian Linux 🙂

[updated] Various aspects of nixCraft can be monitored with RSS feeds including ability to sort out feed – https://www.cyberciti.biz/nixcraft-rss-feed-syndication/

Hope this helps!

@root
I don’t suppose you have noticed that at least 99% of the worlds population are at least some variant of a linux ‘noob’. It would indeed be pointless to run a web site for just the 1% who are whizz kids as you would have very few visitors indeed.

Also, I believe it should be ‘to any linux user who isn’t’

I’ve clearly lost the plot a little myself, ‘at least’ and ‘indeed’ twice in above comment. Have to stop taking these tablets.

In your scripts, the easiest way is to do something like this.

for x in `/sbin/ifconfig | grep Link | awk ‘’ | sort | egrep -v ‘inet6|lo’`
do
echo $x
done

Or you can /sbin/ifconfig $x | grep to extract and read the data into a variable to work on later.

Here is a small code you can use in your scripts.

for x in `/sbin/ifconfig | grep Link | awk ‘’ | sort | egrep -v ‘inet6|lo’`
do
echo $x
done

You can replace echo $x with
/sbin/ifconfig $x | grep (any property you are looking for) and read that into a variable.

I think some of the posts are not being accepted in the comments, Vivek. Not sure why. I thought first it was something in my browser.
I sure hope I didn’t have duplicates in the comments. 🙂

We cache page for 15 minutes. So you will not see updates immediately.

how to check the nic card settings in linux

What distro?
What specifics you are looking for?
If you mean network settings for each card, depending on your distro, it can be found at

For Redhat based distros
/etc/sysconfig/network-scripts/ifcfg-[device Name]

For Debian based distros
/etc/network/interfaces

For in depth, in detail information other settings about your network card, use ethtool.

Run
man ethtool

i have dell and i have wireless in my neighbours but shows me red cross so what i do please

I am new in linux.
now I have problem with my X-Server installation.

my machine used Red Hat V7,2
and my card is used AGX3281.

this is I did for replaced the old card, but I did with the same type.

after I finished the install the X-server, and run startx,
[root@barco1 root]# startx

xinit: No such file or directory (errno 2): no server “X” in PATH

Use the — option, or make sure that /usr/X11R6/bin is in your path and
that “X” is a program or a link to the right type of server
for your display. Possible server names include:

XFree86 XFree86 displays

giving up.
xinit: Connection refused (errno 111): unable to connect to X server
xinit: No such process (errno 3): Server error.

and when I start lspci
[root@barco1 root]# lspci
00:00.0 Host bridge: Intel Corp.: Unknown device 2770 (rev 02)
00:02.0 Display controller: Intel Corp.: Unknown device 2772 (rev 02)
00:1c.0 PCI bridge: Intel Corp.: Unknown device 27d0 (rev 01)
00:1c.1 PCI bridge: Intel Corp.: Unknown device 27d2 (rev 01)
00:1c.2 PCI bridge: Intel Corp.: Unknown device 27d4 (rev 01)
00:1c.3 PCI bridge: Intel Corp.: Unknown device 27d6 (rev 01)
00:1d.0 USB Controller: Intel Corp.: Unknown device 27c8 (rev 01)
00:1d.1 USB Controller: Intel Corp.: Unknown device 27c9 (rev 01)
00:1d.2 USB Controller: Intel Corp.: Unknown device 27ca (rev 01)
00:1d.3 USB Controller: Intel Corp.: Unknown device 27cb (rev 01)
00:1d.7 USB Controller: Intel Corp.: Unknown device 27cc (rev 01)
00:1e.0 PCI bridge: Intel Corp. 82801BAM PCI (rev e1)
00:1f.0 ISA bridge: Intel Corp.: Unknown device 27b8 (rev 01)
00:1f.2 IDE interface: Intel Corp.: Unknown device 27c0 (rev 01)
00:1f.3 SMBus: Intel Corp.: Unknown device 27da (rev 01)
0b:05.0 PCI bridge: Intel Corp.: Unknown device b154
0b:0b.0 Ethernet controller: Intel Corp. 82541PI Gigabit Ethernet Controller (re
v 05)
0c:00.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:01.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:02.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:03.0 VGA compatible controller: ATI Technologies Inc: Unknown device 4c57
0c:04.0 Host bridge: NEC Corporation Vrc5074 [Nile 4] (rev 03)

Источник

Читайте также:  Virtual dvd для windows 10
Оцените статью