Skip to content

Linux Foundations / Understand the system underneath ยท Step 18 of 38

Lesson: lsusb, lspci and lsscsiSwitch
โ† Linux Foundations

System administration

lsusb, lspci and lsscsi

List USB, PCI and SCSI devices and read what the output tells you.

When hardware does not work, first check whether Linux can see it. Three commands list devices on three kinds of connection. They may not be installed: look for the usbutils, pciutils and lsscsi packages. See the packages lab for practice installing software.

lsusb

bash
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver

Each line gives the bus number, the device number, and an ID written as vendor:product in hexadecimal. The names after it are looked up from a database, so an unknown device may show only the ID.

lsusb -t shows the devices as a tree. lsusb -v prints detailed descriptors, often best run with sudo.

lspci

PCI and PCI Express carry devices such as graphics cards, network cards and storage controllers.

bash
lspci
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-V

The leading 00:1f.6 is the bus, device and function address. The most useful option for troubleshooting is -k:

bash
lspci -k -s 00:1f.6
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-V
        Kernel driver in use: e1000e
        Kernel modules: e1000e

This output is shortened.

If there is no "Kernel driver in use" line, no driver is bound to the device. Add -nn to show numeric vendor and device IDs next to the names, which helps when searching documentation.

lsscsi

bash
lsscsi
[0:0:0:0]    disk    ATA      Samsung SSD 870  2B6Q  /dev/sda
[4:0:0:0]    disk    SanDisk  Ultra            1.00  /dev/sdb

The bracketed numbers are host, channel, target and LUN. Then come the type, vendor, model, revision and device node. SATA disks appear here with vendor ATA because Linux handles them through its SCSI layer. USB storage usually appears too. NVMe is not SCSI, but current versions of lsscsi list NVMe drives too, with N as the first item in the brackets. --no-nvme leaves them out.

Add -s to show capacity.

When the list looks empty

A virtual machine shows virtual hardware, not the host's real parts. A container may show little or give errors. Some small boards have no PCI bus at all. In that case, empty output is normal.

Kernel messages are a good next stop. sudo dmesg | tail often shows what happened when you plugged something in.

Try it

  1. Run lsusb, plug in a USB device, run it again and compare.
  2. Run lsusb -t to see how your USB devices are connected.
  3. Run lspci -k and find the driver of your network adapter.
  4. Run lsscsi -s and match the entries with lsblk.

Check your understanding

lsusb, lspci and lsscsi

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.