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
lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying ReceiverEach 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.
lspci00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-VThe leading 00:1f.6 is the bus, device and function address. The most useful option for troubleshooting is -k:
lspci -k -s 00:1f.600:1f.6 Ethernet controller: Intel Corporation Ethernet Connection I219-V
Kernel driver in use: e1000e
Kernel modules: e1000eThis 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
lsscsi[0:0:0:0] disk ATA Samsung SSD 870 2B6Q /dev/sda
[4:0:0:0] disk SanDisk Ultra 1.00 /dev/sdbThe 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
- Run
lsusb, plug in a USB device, run it again and compare. - Run
lsusb -tto see how your USB devices are connected. - Run
lspci -kand find the driver of your network adapter. - Run
lsscsi -sand match the entries withlsblk.
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.