In this article, we would cover lsusb command-line utility in Ubuntu. It is used to list USB devices attached to our machines. These devices can be our printer, scanner, Bluetooth or WiFi dongles etc. Although it may seem trivial to list USB devices. But, sometimes our kernel can't detect a particular device at the boot because of missing device drivers. This is where lsusb can be quite useful. We can easily extract critical information about the device through it.
The lsusb utility comes as default with Ubuntu installation. But, for some reason, if its not there then we need to install package - usbutils. Therefore, first we would cover the installation steps required to get the package. And, thereafter the utility itself.
Note: Following operations would require you to have superuser privileges. In case you don't have one then, we advise you to contact your System Administrator for assistance.
Install usbutils in Ubuntu
If you issue lsusb in the terminal and get the following error then install usbutils.
Command 'lsusb' not found
The package is already available through standard Ubuntu repository. Therefore, first update the repository. This ensures we get to have the latest version of the package available. Hence, open a terminal and issue the following -
sudo apt update
Next, to install usbutils -
sudo apt install usbutils
lsusb in Ubuntu
We start with the basic command without options -
This would return with USB buses and connected devices information -
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 004: ID 0b17:0002 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Now, we move to options part. First, in the line is -v (verbose). It is used to show detailed information about the USB device connected.
Second, if we want to display information for a specific bus or devnum then use -s option,
lsusb -s [bus]:[devnum]
lsusb -s 001:001
It would show us a list of connected USB devices which have the Bus and Device numbers as 001. But, if we use the following -
lsbusb -s 001
It would take 001 as device number and show results accordingly.
Third, to show only devices which are specific to vendor and Product ID use -d option,
lsusb -d [vendor]:[product]
lsusb -d 0b17:0002
It would show us the connected Bluetooth Dongle as mentioned in the output above. It is mandatory to provide both vendor and product ID here. Otherwise, it would yield to nothing.
Fourth, to view connected devices in the form of tree structure use -t option,
Fifth and last, as we have seen with
lsusb -v it displays device information for all the devices. But, what if we want to have detailed information which is specific to a connected device. In that case, we would use -D option.
lsusb -D /dev/bus/usb/[Bus]/[Dev]
For instance, to view a device which has the Bus - 001 and Device - 002
lsusb -D /dev/bus/usb/001/002
In conclusion, the lsusb is Ubuntu quite useful to get detailed information about the connected USB devices.