The `lsusb` command is a utility in Linux that allows users to list the USB (Universal Serial Bus) devices connected to the system. It is a part of the “usbutils” package, which provides utilities to display information about USB buses in the system and the devices connected to them.

USB is a widely used standard for connecting devices to computers. It allows users to connect a variety of devices such as keyboards, mice, printers, and external storage devices to their computers with ease. The lsusb command can be used to display information about these devices, including their vendor and product ID, device name, and device driver.

In this article, we will discuss the syntax and options of the lsusb command, and provide examples of how to use it to list and display information about USB devices in Linux.

Syntax

The basic syntax of the lsusb command is:

Options

Some common options used with the lsusb command are:

  • -v: Display detailed information about the USB devices.
  • -t: Display a tree-like view of the USB devices.
  • -s: Display information about a specific USB device, specified by its bus and device number.
  • -d: Display information about a specific USB device, specified by its vendor and product ID.

Examples

  1. To list all the USB devices connected to the system, use the lsusb command without any options:
    lsusb 
    

    Output

    Bus 002 Device 004: ID 046d:0a37 Logitech, Inc. USB Headset H540 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 413c:301a Dell Computer Corp. Bus 001 Device 003: ID c0f4:05e0 Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  2. To display detailed information about the USB devices, use the -v option:
    lsusb -v 
    
  3. To display a tree-like view of the USB devices, use the -t option:
    lsusb -t 
    

    Output

    /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M |__ Port 1: Dev 4, If 0, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 1: Dev 4, If 1, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 1: Dev 4, If 2, Class=Audio, Driver=snd-usb-audio, 12M |__ Port 1: Dev 4, If 3, Class=Human Interface Device, Driver=usbhid, 12M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 1: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
  4. To display information about a specific USB device, use the -s option followed by the bus and device number. For example, to display information about the USB device on bus 2 and device 4, use the following command:
    lsusb -s 2:4 -v 
    

    Output

    Bus 002 Device 004: ID 046d:0a37 Logitech, Inc. USB Headset H540 Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x046d Logitech, Inc. idProduct 0x0a37 USB Headset H540 bcdDevice 1.22 iManufacturer 1 iProduct 2 iSerial 3 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x011c
  5. To display information about a specific USB device, use the -d option followed by the vendor and product ID. For example, to display information about a device with vendor ID 8087 and product ID c52b, use the following command:
    lsusb -d 1d6b:0002 -v 
    

    Output

    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 9 Hub bDeviceSubClass 0 bDeviceProtocol 0 Full speed (or root) hub bMaxPacketSize0 64 idVendor 0x1d6b Linux Foundation idProduct 0x0002 2.0 root hub bcdDevice 5.15 iManufacturer 3 iProduct 2 iSerial 1

Using the lsusb Command with Other Utilities

The lsusb command can be used in combination with other utilities to perform a variety of tasks.

  1. Find the Vendor and Product ID of a USB Device

    To find the vendor and product ID of a USB device, use the lsusb command with the -v option and grep for the idVendor and idProduct fields:

    lsusb -v | grep -E 'idVendor|idProduct'
    

    Output

    idVendor 0x046d Logitech, Inc. idProduct 0x0a37 USB Headset H540 idVendor 0x8087 Intel Corp. idProduct 0x0024 Integrated Rate Matching Hub idVendor 0x8087 Intel Corp. idProduct 0x0024 Integrated Rate Matching Hub idVendor 0x1d6b Linux Foundation idProduct 0x0002 2.0 root hub
  2. Find the Device Name of a USB Device

    To find the device name of a USB device, use the lsusb command with the -v option and grep for the iProduct field:

    lsusb -v | grep iProduct
    

    Output

    iProduct 2 Logitech USB Headset H540 iProduct 2 EHCI Host Controller iProduct 2 Dell MS116 USB Optical Mouse iProduct 2 usb keyboard
  3. Find the Device Driver of a USB Device

    To find the device driver of a USB device, use the lsusb command with the -t option and grep for the device name:

    lsusb -t | grep Unifying
    

    Output

    |__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

    In this example, the device driver for the USB device is “usbhid”.

  4. Find the Device Node of a USB Device

    To find the device node of a USB device, use the lsusb command with the -t option and look for the device name in the /dev directory:

    lsusb -t
    

    Now execute:

    ls /dev/input/
    

    Output

    by-id event0 event10 event2 event4 event6 event8 mice by-path event1 event11 event3 event5 event7 event9 mouse0

    In this example, the device node for the USB device is /dev/input/mouse0.

Conclusion

In this article, we learned about the lsusb command and how to use it to list and display information about USB devices connected to a Linux system. We also saw how to use the lsusb command with other utilities to perform various tasks related to USB devices.

The lsusb command is useful for troubleshooting issues with USB devices and for finding out more about the devices connected to a system. It can be used to identify the vendor and product ID of a device, which can be helpful in finding the appropriate driver for the device. It can also be used to find the device node of a USB device, which is the entry point for accessing the device in the file system.