Linux lsusb Command
What is the lsusb command?
lsusbIt is a useful command in the Linux system used to list all USB devices connected to the computer. It is the abbreviation of "list USB" and can display the USB bus and detailed information about its connected devices.
Command Purpose
- View the list of USB devices connected to the current system
- Get detailed information about USB devices (vendor ID, product ID, etc.)
- Diagnose USB connection issues
- Verify whether USB devices are correctly recognized by the system
Basic Syntax
lsusb [选项]
Common option parameter descriptions
| Option | Description |
|---|---|
-v |
Display verbose output, including device descriptor information |
-t |
Display the USB device hierarchy in a tree structure |
-s [[bus]:][devnum] |
Only display devices with the specified bus and device number |
-d [vendor]:[product] |
Only display devices with the specified vendor ID and product ID |
-D 设备文件 |
Display detailed information of the specified device file |
--help |
Display help information |
--version |
Display version information |
Basic Usage Examples
1. List all USB devices (basic usage)
Example
Typical output example:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 004: ID 8087:0a2b Intel Corp. Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Output explanation:
Bus XXX: USB bus numberDevice XXX: Device number on that busID XXXX:XXXX: Vendor ID:Product ID- Device description information
2. Display detailed information (-v option)
Example
This command outputs very detailed USB device information, including:
- Device descriptors
- Configuration descriptors
- Interface descriptors
- Endpoint descriptors
- USB protocol versions supported by the device
- Device class, subclass, and protocol
Advanced Usage
1. Display USB device connection relationships in a tree structure
Example
Example output:
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M
|__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 4: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
2. Filter specific devices
Example
lsusb -s 1:
# Only display bus 1 device 3
lsusb -s 1:3
# Only display Logitech devices (via vendor ID:product ID)
lsusb -d 046d:
3. View specific device file information
Example
Practical Application Scenarios
1. Check whether the USB device is recognized
When a USB device is plugged in but cannot be used, first uselsusbto check whether the system recognizes the device.
2. Get the device ID for driver installation
Many Linux drivers need to know the device's vendor ID and product ID. This information can belsusbobtained.
3. Debug USB connection issues
By comparing thelsusboutput before and after plugging in the device, you can determine whether the device is correctly recognized.
4. View detailed USB device information
Use the-voption to get the device's detailed technical specifications, which is helpful for developing USB-related applications.
FAQ
Q1: Why doesn't my USB device appear in the lsusb output?
Possible reasons:
- The device has a physical connection problem
- USB port or hub failure
- Insufficient device power
- Kernel driver issues
Q2: How can I determine device speed from the lsusb output?
In the verbose output (lsusb -v), look for thebcdUSBfield:
2.00: USB 2.03.00: USB 3.03.10: USB 3.1
Q3: How can I permanently save the lsusb output?
Example
Practical Exercises
- Plug in a USB device and observe the
lsusboutput changes. - Use the
-doption to find devices from a specific vendor. - Compare the
lsusbandlsusb -voutput differences. - Try using the
-toption to understand the connection topology of USB devices.
Summary
lsusbIt is a simple but powerful tool that can help users and system administrators:
- Quickly view connected USB devices
- Get detailed device information
- Diagnose USB-related issues
- Provide necessary information for driver installation
Master thelsusbcommand, and you can manage and debug USB devices more efficiently in the Linux environment.
Linux Command Reference