Have you ever encountered a time when you were working in a remote Linux server and needed to check what was connected to the system over USB? To determine the USB devices connected on Linux the simplest way is using the lsusb command.
The lsusb command in Linux is a utility that lists the connected USB devices. This post will touch on the syntax of the command, reading the results, flags, and more.
Basic Syntax
The simplest syntax of the lsusb command is:
lsusb
All instances of the command will follow the following syntax:
lsusb [options]
Results Explained
Now that we know what the syntax looks like, let’s break down the display information or the results of running the lsusb command without any flags.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 0c45:6a17 Microdia Integrated_Webcam_FHD
Bus 003 Device 003: ID 0a5c:5843 Broadcom Corp. 58200
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
We can break these down into 4 separate parts.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- First, each line starts with the USB bus the device is connected too
- Next is the device number that is connected to that USB bus
- Next Comes the unique Vendor and product IDs.
- Last but not least we have the device name and description.
What Are USB Buses?
USB buses are pathways that allow devices to connect to the host system.
What Is A Vendor ID?
Manufacturers of USB devices are assigned a vendor ID by the USB Implementers Forum. This makes sure that vendors use unique IDs.
What Is A Product ID?
The Product ID identifies the specific device made by the vendor the device is.
Flags
Looking for more out of the lsusb command here’s what it can do with flags.
-v, –verbose Display verbose output
-s [[bus]:][devnum] Show only USB devices with specified device and/or bus numbers
-d vendor:[product] Show only devices with the specified vendor and product ID numbers
-D device Selects the device to examine. Make sure to replace device with the full path to the usb device which will be /dev/bus/usb/[bus number]/[device number]
-t, –tree View the physical USB device hierarchy as a tree
-V, –version Check the version of lsusb
-h, –help Show usage and help
But Wait There’s More
In addition to the lsusb command here are some other ways to check for connected USB devices.
The USB-devices Command
The usb-devices command on Linux is used to display detailed information than the lsusb command, though this may be more information than you need.
Logs
Are you instead looking for logs? When devices are connected and disconnected they are logged with to the same place as that is configured for kernel messages. On newer system typically this is handled by systemd, to view USB related events from systemd-journal run the following command:
journalctl -k | grep -i usb
Conclusion
In this post, we answered the question of, how to remotely determine what is connected to USB on your Linux server. Primary we do this by using the lsusb command. In this post we touch on the syntax of the lsusb command, reading the results, flags, and more.
Additional Links
Are you done reading and looking for more, why not check these links out?
Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.
Leave a Reply