Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

lsusb

List USB buses and the USB devices connected to them.

Level
Everyday Linux
Group
Kernel and hardware
Needs root
For changes
Package
usbutils

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

-t, --tree
Tree with drivers and speeds.
-v, --verbose
All details.
-s [[BUS]:][DEVNUM]
Only this device, like -s 001:004.
-d [VENDOR]:[PRODUCT]
Only this vendor/product, like -d 0781:.
-D DEVICE
Read one device file, like /dev/bus/usb/001/004.
-V, --version
Show the version.
-h, --help
Show help.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 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 Fit

    Root hubs are the USB controllers themselves.

  2. 2Tree with drivers

    lsusb -t

    Driver=usb-storage shows a disk; Driver=usbhid a keyboard or mouse.

  3. 3Details of one device

    lsusb -v -s 001:004 | less

    Speed, power, interfaces.

  4. 4Filter by vendor

    lsusb -d 0781:

    All SanDisk devices.

  5. 5Find new devices while plugging in

    watch -n1 lsusb

    A new line appears.

  6. 6Connect with the block device

    dmesg -T | tail; lsblk

    A USB disk becomes /dev/sdX.

  7. 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.

  8. 8Is usb-storage blocked?

    lsusb -t | grep -i storage

    With the blacklist, storage devices have no driver.

  9. 9USB speed

    lsusb -t | grep -o '[0-9]*M$' | sort | uniq -c

    480M = USB 2, 5000M = USB 3.

  10. 10Inventory

    lsusb > /tmp/usb-$(hostname -s).txt

    Hardware list per host.

Files

/usr/share/hwdata/usb.ids
Names of vendors and products.

Exit codes

0 :: Done. 1 :: Error.

Full manual

This page explains the command in simple words. The original manual has every detail.

In your terminal: man 8 lsusb