There are numerous tools in Ubuntu to extract hardware specific information. One utility which we find pretty useful is lspci. It mainly provides us information about PCI buses and devices attached to them. In this article, we cover lspci in Ubuntu. The utility is a part of PCI Utilities package (i.e. pciutils). And, it is installed as default. Therefore, we skip the installation steps here.
It is worth mentioning here that, if you want all the hardware-specific information from the command-line utility lspci then, use superuser privileges to issue the command. Otherwise, you may notice <access denied> on some fields which required such privileges.
PCI or Peripheral Component Interconnect is used to attach hardware to our computer.
Note: Few of the operations mentioned below may require superuser privileges. In case you don't have then, we advise you to contact your System Administrator for assistance.
Update PCI IDs
A PCI ID would contain information - vendors, classes, devices etc. All the PCI ID's are stored in file -
Update it regularly. The following command is used to update PCI IDs -
lspci in Ubuntu
Use the following to view a list of devices -
For detailed information (also displays - kernel drivers and modules related info as default for Linux Kernel 2.6 and newer) about the devices use -v option,
For previous Linux Kernel versions, we need to use -k option for above kernel drivers/modules information -
At this stage, you may see the following text for some fields. For instance -
Capabilities: <access denied>
We need to run the command as superuser (or, with sudo) to access that information -
sudo lspci -v
Apart from, if we want to extract more detailed information then, use -
For tree-like structure, use -t option -
Identify PCI devices with Vendor and Device ID
Use the following command -
Vendor and Device IDs would be shown as [xxxx:yyyy]. Where,
xxxx is the Vendor ID and,
yyyy is the Device ID.
Now, to extract information about a specific Device or Vendor -
lspci -d <vendor_id>:<device_id>
lspci - Machine readable output format
For machine readable output format, we can use any of the following options -
lspci -m lspci -vm lspci -vmm
In conclusion, we have covered lspci in Ubuntu here. It is mainly used to extract information about PCI bus and attached devices.