The lspci command in Linux is the essential tool when you want to find out about drivers you're having trouble fixing (or simply need to see what's actually in your computer), along with lsusb for USB devices.
These commands provide you with a clear view of all the hardware installed in your Linux box, and together they give you information for virtually everything that is physically hooked up to it. lspci will show you the PCI bus and its associated devices. On the other hand, lsusb displays each USB controller plus all the devices which have been plugged into their ports.
These commands both originate from the same family of programs that pull data directly from the kernel. Both commands can be safely run by a standard user; they function in an identical manner among most distributions. Below, I'll walk you through twelve real-world examples of how I use these two commands in my daily administration activities. I've demonstrated each example using RHEL , Rocky Linux and Ubuntu .
Tip:
lspci and lsusb do nothing more than report on what hardware exists. Neither 'lspci' nor 'lsusb' can alter settings, load drivers, or physically interact with the device(s) being inspected. If you would like to use those commands to view active processes employing that hardware instead, see the documentation for the ps command.
Examples
lsusb [OPTIONS]
# List all PCI devices
lspci
# List all USB devices
lsusb
# Verbose output for a single device
lspci -v -s 00:02.0
Tip : lspci vs lsusb in plain English:
Think of lspci as an internal hardware inspection command for hardware (e.g. graphics cards, network controllers, etc.) which sit on the motherboard. Think of lsusb as an inspection command for all items which are attached to the system via a USB connection: keyboards, mice, cameras/webcam's, printer/s, portable disk drives/external disks. The actual controller chip sits on the PCI bus thus shows up as a "device" in lspci. However, all the peripherals (i.e., keys/mouse/camera/etc) connected through this controller are reported by lsusb.
Basic lspci Command in Linux: List All PCI Devices
The lspci command shows you all of the PCI devices that are visible to the kernel. It is the quickest method to get an overview of your system's internal hardware. Each line consists of the bus address for the PCI device, then the device class, followed by a brief vendor description for the pci device.
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI
00:17.0 SATA controller: Intel Corporation Cannon Lake PCH SATA AHCI Controller
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (7) I219-V
02:00.0 Network controller: Intel Corporation Wireless-AC 9560
Note:
The first field (for example 00:1f.6) is the PCI address in bus:slot.function format. You will use this address later when filtering with -s.
Show Detailed Info with lspci Verbose Mode
If you add -v on to lspci it will turn a single-line summary of a PCI device into a full report. This option provides additional information about the device, including the kernel module being used, IRQ (interrupt request), memory regions, and subsystem vendor. It is one of most commonly option I use when a device appears to be malfunctioning.
Subsystem: Dell UHD Graphics 630
Flags: bus master, fast devsel, latency 0, IRQ 139
Memory at a2000000 (64-bit, non-prefetchable) [size=16M]
Memory at 90000000 (64-bit, prefetchable) [size=256M]
I/O ports at 5000 [size=64]
Kernel driver in use: i915
Kernel modules: i915
Tip:
lspci -vv adds capability blocks, and lspci -vvv dumps almost everything the kernel knows. The very verbose output usually needs root for some fields, so prefix it with sudo. See the sudo configuration guide if you need a refresher and offical lspci man page.
Display a Tree View of PCI Buses
The -t option converts a flat list to a tree, allowing you to see what device resides behind each bridge. This can be helpful on servers with multiple PCI domains, or if you have bandwidth issues related to a specific slot.
+-02.0 Intel Corporation UHD Graphics 630
+-14.0 Intel Corporation USB 3.1 xHCI Controller
+-17.0 Intel Corporation SATA AHCI Controller
+-1c.0-[02]----00.0 Intel Corporation Wireless-AC 9560
\-1f.6 Intel Corporation Ethernet I219-V
Note:
-t with -v (as -tv) keeps the tree shape but adds a short description for every node, which is usually what you want.
Show Numeric Vendor and Device IDs
While the vendor string may give you an idea of where to look, it is often that you will need the hexadecimal representation of the numeric vendor:device pair in order to search for a driver. The -nn option displays both the name and the numeric ID of the device on one line.
00:1f.6 Ethernet controller [0200]: Intel Corporation I219-V [8086:15bc]
02:00.0 Network controller [0280]: Intel Corporation Wireless-AC 9560 [8086:a370]
Tip:
[8086:3e9b]) is the value you search for on kernel mailing lists and on pci-ids.ucw.cz when a device shows up as "Unknown".
Check the Kernel Driver in Use with lspci -k
If a device appears in lspci yet isn't functioning, the first step I take is checking if the kernel even bound a driver to it. The -k flag will tell you this. It will give you information about the module or modules that are associated with the particular device, along with the driver.
Subsystem: Intel Corporation Wireless-AC 9560
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi
00:1f.6 Ethernet controller: Intel Corporation I219-V
Kernel driver in use: e1000e
Kernel modules: e1000e
Note:
Inspect a Single PCI Device by Address
Instead of having to scroll down the entire list, you can specify which device to focus on with lspci's -s flag, combined with -vv for maximum details.
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast
Latency: 0, Cache Line Size: 64 bytes
Capabilities: [40] Vendor Specific Information: Len=0c
Capabilities: [70] Express Root Complex Integrated Endpoint
Kernel driver in use: i915
Tip:
-d. For example, lspci -d 8086:: prints only Intel devices and lspci -d ::0300 shows only VGA controllers.
List all USB Devices with lsusb
Now let’s look at USB. The command lsusb will provide you with a listing of all devices enumerated by the kernel, each one listed on its own line. For each line there will be the bus number, the device number, the vendor:product identifier in hexadecimal format, and the name of the device as a string.
Bus 001 Device 004: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak
Bus 001 Device 002: ID 0bda:58f4 Realtek Semiconductor Corp. Integrated Webcam
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Note:
Show USB Devices in a Tree with lsusb -t
When you want to view a topology diagram showing how each device is related to the hubs they sit behind and their speeds, use lsusb with the -t option. This will allow you to quickly determine why a USB 3 device does not appear to be running at its intended speed; it may simply be plugged into a USB 2 port instead of a USB 3 port.
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 2: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 2: Dev 2, If 1, Class=Audio, Driver=snd-usb-audio, 480M
|__ Port 6: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 9: Dev 4, If 0, Class=HID, Driver=usbhid, 12M
Tip:
5000M means USB 3.0, 480M is USB 2.0 high speed, and 12M is USB 1.1. If a USB 3 drive shows up at 480M, try a different port or cable.
Get Full USB Device Details with lsusb -v
To dump the complete descriptor for every single device using lsusb, use the -v option. Due to the volume of information generated by this option, you usually pair it with -s to show information for only one device. Additionally, due to access restrictions to certain parts of the descriptors, you would need to run this command with elevated privileges.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
idVendor 0x046d Logitech, Inc.
idProduct 0xc534 Unifying Receiver
iManufacturer 1 Logitech
iProduct 2 USB Receiver
bNumConfigurations 1
Note:
-s for lsusb is bus:device, not the PCI style address used by lspci. You can read those two numbers straight off the first field of the plain lsusb output.
Filter lsusb Output by Vendor or Product
If you want to narrow the amount of time spent viewing information from lsusb, use the -d option which allows you to filter based upon a given vendor:product ID.
Tip:
046d:) to match every product from that vendor. You can also pipe the full list through grep if you prefer: lsusb | grep -i logitech.
Find Specific Hardware by Piping to grep
If you are running many servers at one time, there can be many devices listed. There is no easier method of answering simple questions about your system such as "Do I have a network card installed?" or "Is my webcam working?" other than piping lspci or lsusb through grep to search for what you want quickly without having to look through every line.
02:00.0 Network controller: Intel Corporation Wireless-AC 9560
Note:
lsusb | grep -i webcam or lsusb | grep -i storage. For a deeper look at filtering, the find command guide is worth a read.
Refresh the PCI and USB ID Database with update-pciids
You may also come across entries labeled "unknown device" followed by a vendor ID. This simply indicates that your local database does not currently contain information on this newer piece of hardware. By running update-pciids (which typically requires update-usbids to run as well), you can pull down a new list of IDs which will allow the proper name of the device to appear where previously it was unknown.
% Total % Received % Xferd Average Speed
100 320k 100 320k 0 0 412k 0 0:00:00 --:--:-- 412k
Done.
Tip:
usbutils package and is updated via the package manager. On RHEL and CentOS, update-pciids handles PCI and the USB list gets refreshed through dnf update or yum update. Check the yum commands guide if that part is new to you.
Danger — Do Not Remove PCI Cards on a Running Server:
Reading hardware info with lspci and lsusb is safe, but it is not always safe to act on what you find. Unplugging internal PCI or PCIe cards while the system is powered on will probably corrupt data, crash the kernel, or damage both the card and motherboard. For USB devices the rule is lighter. Hot plugging keyboards, mouses, and memory sticks is fine. Just unmount your USB storage device before pulling it out.
From your first terminal command to advanced sysadmin skills, every guide here is written in plain English with real examples you can run right now.