In the daily use and maintenance of Linux systems, mastering USB device information is key to troubleshooting and managing external devices. This article will introduce three commonly used commands to help you quickly obtain USB device details and efficiently manage devices.

1. lsusb: Quickly View Core Information
lsusb is the most basic command for viewing USB devices, capable of quickly listing key information such as bus number, vendor ID, and product ID of connected devices, making it suitable for quickly confirming device connection status.
1. Installation and Usage
Most Linux systems do not come pre-installed with lsusb, and it needs to be installed via the package manager (using Debian/Ubuntu as an example):
sudo apt-get install usbutils
After installation, simply enter the command in the terminal to view:
lsusb
2. Output Interpretation
Example output:
Bus 001 Device 002: ID 04f2:b3cd Chicony Electronics Co., Ltd HP HD Webcam
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
“Bus 001” and “Device 002”: represent the bus number and device number of the connected device, respectively;
“ID 04f2:b3cd”: the first half is the vendor ID, and the second half is the product ID, which can be used to query specific device information;
The last text: clearly indicates the device name, such as “HP HD Webcam” (HP HD Webcam), while “root hub” refers to the system USB root hub.
2. usb-devices: Obtain Detailed Parameters
If more comprehensive device information is needed (such as power supply, speed, driver), the usb-devices command is more suitable, meeting the needs of system administrators for debugging and troubleshooting.
1. Installation and Usage
This command is also included in the usbutils package, and if lsusb is already installed, no further action is needed; simply execute:
usb-devices
2. Output Interpretation
Each section corresponds to a device, taking the root hub as an example:
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh=14D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1P: Vendor=1d6b ProdID=0002 Rev=05.10S: Manufacturer=Linux 5.10.0-8-amd64 xhci-hcdC: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mAI: If#= 0 Alt=0 #EPs=1 Cls=09(hub) Sub=00 Prot=00 Driver=hub
The “T” line: “Spd=480” indicates USB 2.0 speed (480Mbps), and “MxCh=14” indicates the hub can connect up to 14 devices;
The “D” line: “Ver=2.00” is the USB protocol version, and “Cls=09 (hub)” indicates the device category is a hub;
The “P” line: displays vendor ID, product ID, and firmware version;
The “S” line: indicates the device manufacturer;
The “C” line: “MxPwr=0mA” indicates the root hub does not require external power;
The “I” line: “Driver=hub” specifies the driver used by the device.
Now looking at the camera device segment:
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=480
S: Product=HP HD Webcam
“Lev=01” indicates the camera is connected under the root hub (Lev=00), and “Prnt=01” points to the parent device (the root hub), clearly presenting the device connection hierarchy.
3. dmesg: View System Logs
dmesg is used to display the system kernel log, which includes the detection and initialization process of USB devices, helping to troubleshoot issues such as device connection failures and driver anomalies.
1. Usage
No installation is required; simply use grep to filter USB-related logs:
dmesg | grep “USB”
2. Output Interpretation
Example output:
[ 1.123456] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[ 1.234567] usb 1-1: New USB device found, idVendor=04f2, idProduct=b3cd
[ 1.456789] usb 1-1: Product: HP HD Webcam
The numbers in square brackets: the time (in seconds) after the system boot, marking the order of events;
Key information: “new high-speed USB device” indicates a new high-speed device has been detected, “idVendor” and “idProduct” are consistent with the previous text, and “Product” clearly indicates the device name;
Troubleshooting: If the device connection is abnormal, the log will indicate errors (such as “device not accepting address”), which can help locate hardware or driver issues.
By mastering these three commands, whether you are a regular user managing external devices or an administrator maintaining the system, you can easily handle USB device-related operations.