HowTo: Linux Show List Of Network Cards

by on August 29, 2012 · 20 comments· LAST UPDATED September 4, 2012

in ,

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.

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
Estimated completion timeN/A

  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.

lspci command

Type the following command:
# lspci | egrep -i --color 'network|ethernet'
Sample outputs:

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

lshw command

The lshw command can extract detailed information on the hardware configuration of the machine including network cards. Type the following command:
# lshw -class network
Sample outputs:

  *-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

ifconfig and ip command

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

/proc/net/dev

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.
$ cat /proc/net/dev
Sample outputs:

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
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 20 comments… read them below or add one }

1 Julian August 29, 2012 at 3:28 pm

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

Reply

2 Chex August 29, 2012 at 5:00 pm

Use

ip link show

Reply

3 Leaman Crews August 30, 2012 at 12:54 am

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

Reply

4 nixCraft August 30, 2012 at 1:04 am

It was a typo on part.

ip a

However, ip link show should be used.

Reply

5 brian t August 29, 2012 at 9:41 pm

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.

Reply

6 dude August 30, 2012 at 1:00 am

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

Reply

7 nixCraft August 30, 2012 at 1:09 am

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

ethtool -i eth0
ethtool -i wlan0

OR

lspci -v -s deviceID

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

Reply

8 root August 30, 2012 at 5:47 am

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.

Reply

9 nixCraft August 30, 2012 at 6:15 am

@root,

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.

Reply

10 lolcat December 6, 2013 at 9:18 pm

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.

Reply

11 BobTheCat December 7, 2013 at 5:43 am

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 :)

Reply

12 nixCraft September 4, 2012 at 5:31 am

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

Hope this helps!

Reply

13 Anthony August 30, 2012 at 7:46 am

@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’

Regards.

Reply

14 Anthony August 30, 2012 at 8:55 pm

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

Reply

15 Aram Iskenderiann September 2, 2012 at 4:14 am

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

for x in `/sbin/ifconfig | grep Link | awk ‘{print $1}’ | 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.

Reply

16 Aram Iskenderian September 2, 2012 at 4:25 am

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

for x in `/sbin/ifconfig | grep Link | awk ‘{print $1}’ | 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.

Reply

17 Aram Iskenderian September 2, 2012 at 4:28 am

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. :-)

Reply

18 nixCraft September 2, 2012 at 9:33 am

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

Reply

19 Augustin October 7, 2013 at 9:59 am

how to check the nic card settings in linux

Reply

20 Aram Iskenderian October 10, 2013 at 7:09 am

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

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: