brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: lsusb lists USB devices, and lsusb -t shows them as a tree

Linux
~/tips/tip-linux-lsusb-list-usb-devices

lsusb -t

Lists the USB devices the kernel sees, with the -t option showing how hubs and devices connect.

When a USB stick, webcam or dongle is not doing what it should, the first question is whether Linux sees it at all. lsusb answers that.

lsusb
lsusb -t

The plain command prints one line per device with its bus number, device number, vendor and product ID and a name. The IDs look like 1d6b:0002, and those are what you search for when you need a driver or firmware.

With -t, lsusb dumps the physical USB device hierarchy as a tree. You see which devices hang off which hub, and the driver in use for each. That is also how I would spot a fast device that is plugged into a slow port, since the tree shows the speed per device.

A useful trick is to run it before and after plugging something in:

lsusb > before.txt
# plug in the device
lsusb | diff before.txt -

The difference is the new device.

The caveat is where the names come from. They are looked up in a database of USB IDs, so a new device may show up with only the numbers, even though it works fine. A missing line, on the other hand, is a real signal: the kernel does not see the device, which points to a cable, a port or a dead gadget. The command comes with the usbutils package, which is not installed on every minimal system.

Further reading: lsusb(8) manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link