Quick Links

Learn how to use the lsusb tool in Linux with a practical example. The lsusb will list all USB devices in a system and USB hubs and provide detailed information on each of them.

What Is lsusb?

lsusb is a command-line tool in Linux, installed by default as part of your (modern) Linux Operating System, which can list and enumerate all USB devices, including USB hubs found within the system on which it is being executed. It will work on desktops, servers, and other common Linux-running hardware like Raspberry Pi's, etc.

As the tool is installed by default, there is no need to install it, and it cannot be uninstalled. The only way to remove it completely from a system would be to use sudo to remove (

        rm
    

) the actual binary (commonly at

        /usr/bin/lsusb
    

) and the manual (commonly at

        /usr/share/man/man8/lsusb.8.gz
    

).

You can access the complete but small lsusb manual by issuing

        man lsusb
    

at a Terminal command prompt.

Partial lsusb manual page

To access the command prompt, if you are using a desktop GUI, you will often have to click your operating system's action button (like the green button commonly at the bottom left in Linux Mint or the Activities button at the top left in Ubuntu) and type Terminal and click the corresponding option, or you may like to try the Windows key on your keyboard in combination with the letter

        T
    

(hold the Windows key, then press

        T
    

).

Using lsusb: First Run

When you first run lsusb from a Terminal command prompt, you will get a brief/concise list of output, showing various items of information about the USB devices in your system:

lsusb
    

First lsusb run without any options

Here we first see the USB Bus (a computer/system bus is a transport mechanism the customer uses, just like a bus in real life, to transport data from one item to another, for example, from a USB device - like a mouse or keyboard - to the processor) number, followed by a device number, a USB Device ID and finally a textual description of the device.

Note that the USB Device ID has two parts. The first part (before the :) is a USB devices vendor identifier, associated with a specific vendor, and the second part is a subsystem USB device number. So, for example, the Holtek Semiconductor device with USB device ID 04d9:1203 has 04d9 which is associated with Holtek Semiconductor, Inc. and the subsystem device (the actual USB device or USB software emulator by that vendor) is a keyboard.

Of interest here is that such Device IDs can be entered into your favorite search engine. Preferably this should be done with double quotes around the full ID or without quotes if you are only searching the first or second part, in which case you may want to add USB as a generic keyword. In both cases, this would produce reliable search results.

Having the ability to search such Device IDs online also opens up the possibility to find that driver for that odd USB device from years ago by using a Device ID. You can add a keyword like "driver", "download" and/or similar to obtain more accurate search results.

Note that it may also be possible to search for a similar driver by the same hardware vendor if you cannot find the actual target driver, as sometimes drivers include support for a whole array of devices by the manufacturer. Finally, the last textual output column of the lsusb output may provide a good hint as to what the device is.

Also, note that devices listed in lsusb are not necessarily always hardware/physical devices. They may be software hub interfaces that take care of, for example, relaying hardware signals from an actual physical USB device to the operating system. For example, let's run lsusb inside VirtualBox (a software package that emulates computer hardware and allows running other operating systems from within a host operating system):

lsusb output on VirtualBox

Note that VirtualBox will use (or rather; emulate) the most common/default USB standard, i.e. Linux Foundation 1.1 root hub whereas a modern system will also list Linux Foundation 2.0 root hub and Linux Foundation 3.0 root hub hubs - i.e. USB 1.1 versus USB 2.0 and USB 3.0. This is handy if you quickly want to see if a system is modern or not; lsusb will show if there is a USB 3.0 hub in the system (if the hardware is not virtualized), a good indicator that the system at least has some level of modernity!

lsusb: Diving Deeper

Once you get used to using lsusb as part of your regular workflow, you will want to explore some of the command line options available. The -d [vendor]:[product] is handy if you want to search for a specific vendor and product ID. Similarly you can search by Bus number and Device number using the -s [[bus]:][devnum] option. Note that here the bus part of the option is optional.

So how can you search for just a Product ID without searching for a vendor? You can use grep:

lsusb -s and -d options and grepping for the USB Device ID

Note that using a Product ID with the option -s (i.e. an incorrect combination of options/input as the Product ID should be used with the -d option instead) may lead to unexpected output as lsusb tries and parses the input provided a USB bus and device number option:

Incorrect usage of the -s option gives unexpected lsusb output

You can also find a plethora of technical information for each USB device by specifying the -v option. Generally you will want to add sudo to provide all available information about the device:

sudo lsusb -d your:deviceid -v 2>/dev/null | grep 'MaxPower'
    

MaxPower grep using sudo lsusb in verbose mode

The output of lsusb -v is very verbose, so we only selected a single item of interest: the MaxPower for the Logitech Optical Wheel Mouse, selected with the -d option. We also suppress any lsusb errors by redirecting stderr (standard error) output to /dev/null for the lsusb command (before piping it to grep to select the item of interest.

Use lsusb -v to see all detailed information for all connected devices and hubs (including software devices). Note that the output will likely scroll for several pages, especially on modern or non-hardware-emulated systems.

Wrapping up

In this article we reviewed how to use the lsusb tool in Linux. We looked at how to start the tool from a Terminal prompt in Linux and how to use various options to control the output and informativeness of lsusb.

If you enjoyed reading this article, you may like to read How to Use lsof in Linux (With a Practical Example) next! Enjoy!