Linux list all pci devices

lspci(8) — Linux man page

lspci — list all PCI devices

Synopsis

Description

lspci is a utility for displaying information about PCI buses in the system and devices connected to them.

By default, it shows a brief list of devices. Use the options described below to request either a more verbose output or output intended for parsing by other programs.

If you are going to report bugs in PCI device drivers or in lspci itself, please include output of «lspci -vvx» or even better «lspci -vvxxx» (however, see below for possible caveats).

Some parts of the output, especially in the highly verbose modes, are probably intelligible only to experienced PCI hackers. For exact definitions of the fields, please consult either the PCI specifications or the header.h and /usr/include/linux/pci.h include files.

Access to some parts of the PCI configuration space is restricted to root on many operating systems, so the features of lspci available to normal users are limited. However, lspci tries its best to display as much as available and mark all other information with text.

Options

Basic display modes -m

Dump PCI device data in a backward-compatible machine readable form. See below for details.

Dump PCI device data in a machine readable form for easy parsing by scripts. See below for details.

Show a tree-like diagram containing all buses, bridges, devices and connections between them.

Be verbose and display detailed information about all devices.

Be very verbose and display more details. This level includes everything deemed useful.

Be even more verbose and display everything we are able to parse, even if it doesn’t look interesting at all (e.g., undefined memory regions).

Show kernel drivers handling each device and also kernel modules capable of handling it. Turned on by default when -v is given in the normal mode of output. (Currently works only on Linux with kernel 2.6 or newer.)

Show hexadecimal dump of the standard part of the configuration space (the first 64 bytes or 128 bytes for CardBus bridges).

Show hexadecimal dump of the whole PCI configuration space. It is available only to root as several PCI devices crash when you try to read some parts of the config space (this behavior probably doesn’t violate the PCI standard, but it’s at least very stupid). However, such devices are rare, so you needn’t worry much.

Show hexadecimal dump of the extended (4096-byte) PCI configuration space available on PCI-X 2.0 and PCI Express buses.

Bus-centric view. Show all IRQ numbers and addresses as seen by the cards on the PCI bus instead of as seen by the kernel.

Always show PCI domain numbers. By default, lspci suppresses them on machines which have only domain 0.

Options to control resolving ID’s to names -n

Show PCI vendor and device codes as numbers instead of looking them up in the PCI ID list.

Show PCI vendor and device codes as both numbers and names.

Use DNS to query the central PCI ID database if a device is not found in the local pci.ids file. If the DNS query succeeds, the result is cached in

/.pciids-cache and it is recognized in subsequent runs even if -q is not given any more. Please use this switch inside automated scripts only with caution to avoid overloading the database servers.

Same as -q, but the local cache is reset.

Query the central database even for entries which are recognized locally. Use this if you suspect that the displayed entry is wrong.

Options for selection of devices -s [[[[ ]:] ]:][ ][.[ ]] Show only devices in the specified domain (in case your machine has several host bridges, they can either share a common bus number space or each of them can address a PCI domain of its own; domains are numbered from 0 to ffff), bus (0 to ff), slot (0 to 1f) and function (0 to 7). Each component of the device address can be omitted or set to «*», both meaning «any value». All numbers are hexadecimal. E.g., «0:» means all devices on bus 0, «0» means all functions of device 0 on any bus, «0.3» selects third function of device 0 on all buses and «.4» shows only the fourth function of each device. -d [ ]:[ ] Show only devices with specified vendor and device ID. Both ID’s are given in hexadecimal and may be omitted or given as «*», both meaning «any value».

Other options -i Use as the PCI ID list instead of /usr/share/hwdata/pci.ids. -p Use as the map of PCI ID’s handled by kernel modules. By default, lspci uses /lib/modules/kernel_version/modules.pcimap. Applies only to Linux systems with recent enough module tools. -M

Invoke bus mapping mode which performs a thorough scan of all PCI devices, including those behind misconfigured bridges, etc. This option gives meaningful results only with a direct hardware access mode, which usually requires root privileges. Please note that the bus mapper only scans PCI domain 0. —version Shows lspci version. This option should be used stand-alone.

Читайте также:  Посмотреть сколько всего оперативной памяти linux

PCI access options The PCI utilities use the PCI library to talk to PCI devices (see pcilib(7) for details). You can use the following options to influence its behavior: -A The library supports a variety of methods to access the PCI hardware. By default, it uses the first access method available, but you can use this option to override this decision. See -A help for a list of available methods and their descriptions. -O

= The behavior of the library is controlled by several named parameters. This option allows to set the value of any of the parameters. Use -O help for a list of known parameters and their default values. -H1

Use direct hardware access via Intel configuration mechanism 1. (This is a shorthand for -A intel-conf1.)

Use direct hardware access via Intel configuration mechanism 2. (This is a shorthand for -A intel-conf2.) -F Instead of accessing real hardware, read the list of devices and values of their configuration registers from the given file produced by an earlier run of lspci -x. This is very useful for analysis of user-supplied bug reports, because you can display the hardware configuration in any way you want without disturbing the user with requests for more dumps. -G

Increase debug level of the library.

Machine Readable Output

If you intend to process the output of lspci automatically, please use one of the machine-readable output formats (-m, -vm, -vmm) described in this section. All other formats are likely to change between versions of lspci.

All numbers are always printed in hexadecimal. If you want to process numeric ID’s instead of names, please add the -n switch.

Simple format (-m) In the simple format, each device is described on a single line, which is formatted as parameters suitable for passing to a shell script, i.e., values separated by whitespaces, quoted and escaped if necessary. Some of the arguments are positional: slot, class, vendor name, device name, subsystem vendor name and subsystem name (the last two are empty if the device has no subsystem); the remaining arguments are option-like: -rrev

Revision number. -pprogif Programming interface. The relative order of positional arguments and options is undefined. New options can be added in future versions, but they will always have a single argument not separated from the option by any spaces, so they can be easily ignored if not recognized.

Verbose format (-vmm) The verbose output is a sequence of records separated by blank lines. Each record describes a single device by a sequence of lines, each line containing a single ‘tag: value‘ pair. The tag and the value are separated by a single tab character. Neither the records nor the lines within a record are in any particular order. Tags are case-sensitive.

The following tags are defined: Slot

The name of the slot where the device resides ([domain:]bus:device.function). This tag is always the first in a record.

Name of the class.

Name of the vendor.

Name of the device. SVendor Name of the subsystem vendor (optional). SDevice Name of the subsystem (optional). PhySlot The physical slot where the device resides (optional, Linux only). Rev

Revision number (optional).

Programming interface (optional).

Kernel driver currently handling the device (optional, Linux only).

Kernel module reporting that it is capable of handling the device (optional, Linux only). New tags can be added in future versions, so you should silently ignore any tags you don’t recognize.

Backward-compatible verbose format (-vm) In this mode, lspci tries to be perfectly compatible with its old versions. It’s almost the same as the regular verbose format, but the Device tag is used for both the slot and the device name, so it occurs twice in a single record. Please avoid using this format in any new code.

Files

/usr/share/hwdata/pci.ids A list of all known PCI ID’s (vendors, devices, classes and subclasses). Maintained at http://pciids.sourceforge.net/, use the update-pciids utility to download the most recent version. /usr/share/hwdata/pci.ids.gz If lspci is compiled with support for compression, this file is tried before pci.ids.

/.pciids-cache All ID’s found in the DNS query mode are cached in this file.

Sometimes, lspci is not able to decode the configuration registers completely. This usually happens when not enough documentation was available to the authors. In such cases, it at least prints the mark to signal that there is potentially something more to say. If you know the details, patches will be of course welcome.

Access to the extended configuration space is currently supported only by the linux_sysfs back-end.

See Also

Author

The PCI Utilities are maintained by Martin Mares .

Источник

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)

Источник

Читайте также:  Telnet ������� �� ������� linux
Оцените статью