What it does
lsusb prints one line per device with bus, device number, vendor:product ID and name. -t shows the tree with the driver of each interface; -v shows every descriptor (root for all details).
How to write it
lsusb [OPTION]...Options 7
Most used
Nothing matches this filter.
Examples 10
$ run as a normal user# run as root (or with sudo)
1All USB devices
lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 0781:5583 SanDisk Corp. Ultra FitRoot hubs are the USB controllers themselves.
2Tree with drivers
lsusb -tDriver=usb-storage shows a disk; Driver=usbhid a keyboard or mouse.
3Details of one device
lsusb -v -s 001:004 | lessSpeed, power, interfaces.
4Filter by vendor
lsusb -d 0781:All SanDisk devices.
5Find new devices while plugging in
watch -n1 lsusbA new line appears.
6Connect with the block device
A USB disk becomes /dev/sdX.
7Check for unknown devices (security)
lsusb | grep -viE 'root hub|keyboard|mouse'Unknown USB devices on a server can be keyloggers or rogue network cards.
8Is usb-storage blocked?
lsusb -t | grep -i storageWith the blacklist, storage devices have no driver.
9USB speed
480M = USB 2, 5000M = USB 3.
10Inventory
lsusb > /tmp/usb-$(hostname -s).txtHardware list per host.
Nothing matches this filter.
Files
/usr/share/hwdata/usb.ids- Names of vendors and products.
Exit codes
0 :: Done. 1 :: Error.