Get List of USB Devices in Linux

Get List of USB Devices in Linux

Many peripheral devices have USB interface to connect to the computer such as webcams, keyboards, mouses, hard drives, etc. This tutorial demonstrates how to get a list of USB devices in the Linux.

The lsusb command can be used for displaying information about USB devices in the system. Run lsusb command without any arguments to get a list of USB devices:

lsusb

Output example:

Bus 001 Device 004: ID 0781:5530 SanDisk Corp. Cruzer
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

In our case, many devices are virtual because we are using VMware virtual machine.

To get detailed information of each device, use the -v option:

lsusb -v

Output example:

Bus 001 Device 004: ID 0781:5530 SanDisk Corp. Cruzer
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           0x0781 SanDisk Corp.
  idProduct          0x5530 Cruzer
  bcdDevice            1.07
  iManufacturer           1 SanDisk Corporation
...

Use the -t option, to get USB devices hierarchy as a tree:

lsusb -t

Output example:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/7p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
    |__ Port 1: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M

Leave a Comment

Cancel reply

Your email address will not be published.