Situatie
Your Linux command line is filled to the brim with commands you can use to learn about and use your device more effectively. Recently, I figured out a few handy uses for the lsusb command.
In case you aren’t familar, the lsusb command gets its name from the ls command you might already be familiar with. ls is short for “list” and of course usb refers to the Universal Serial Bus, the category of computer port we’re all using all the time.
Identify a device’s vendor
Sometimes, when you get a flash drive or a computer peripheral, it’s unclear who the manufacturer is. So-called white label products may have one company’s logo on them, but that company simply bought it from another and stamped it themselves. If you want to find out who the real manufacturer is, otherwise known as the vendor, you can check that with the lsusb command. You’ll see a bunch of devices listed the first time you run it, but if you unplug the device and run lsusb again, you can identify the one you’re investigating because it will disappear in the second readout. For example, here’s an entry I identified for a flash drive I have:
Bus 004 Device 011: ID 13fe:6700 Phison Electronics Corp. USB DISK 3.0
I identified it by noticing it was missing from lsusb’s output after I removed it.
In this case, the vendor’s ID code is 13fe, and lsusb has identified that vendor as Phison Electronics Corp. If I wanted to learn more, or if lsusb for some reason couldn’t produce a vendor name, I could do a web search like “device vendor ID 13fe” and an online database will likely be able to identify it for me and show me other products it produces.
Solutie
Identify a specific USB device model
You might have noticed that the ID code has a second set of characters following the vendor ID. That’s the device ID, which you can use to make sure you have one specific product from a vendor and not another.
Looking at the same output again:
Bus 004 Device 011: ID 13fe:6700 Phison Electronics Corp. USB DISK 3.0
The device ID number is 6700. Once you have the vendor and device ID codes, you can use a lookup service like Device Hunt to look up the precise model you have.
Find your USB port’s maximum transfer speed
I know from experience that figuring out how fast your USB port is can be a real challenge. Computer manufacturers don’t always label them, and even when they do, it’s not always correct or informative. USB port colors aren’t completely reliable either. Linux’s lsusb command to the rescue! The first step is to identify the root hub. You probably noticed that there were a lot of devices listed, and in addition to detachable USB devices, all USB ports and their capabilities are listed there too. Again, identifying a specific port is easy if you have an external USB device on-hand to plug in an unplug for testing purposes. First, run lsusb with the -t flag to see devices listed in a tree format for easier reading.
lsusb -t
You’ll see a bunch of devices. To narrow down which is the USB port you want to check, plug a device into that port and run the command again. You’ll see the new device appear as a “branch” under the relevant USB controller port. There will be a number printed at the end of that trunk entry with an M at the end.
This is the port’s maximum theoretical speed, in megabytes. So if the output is 480M, you know the maximum speed is 480Mbps.
Check a USB device’s maximum speed
Even if your port is rated for a certain transfer speed, you’re still limited by all kinds of factors, not the least of which includes the connected USB device’s maximum speed. Fortunately, lsusb is also able to show you that speed. However, in this case you need to make sure you use the -t flag, since it reveals the speed.
lsusb -t
In my case, I identified this entry as my flash drive:
Port 002: Dev 011, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
The number at the end of the entry with an M is not the storage size but the maximum number of megabytes per second. In this case, since it says 5000M, the maximum speed is 5,000Mbps, or more efficiently notated as 5Gbps. With this information in hand, you can verify a retailer’s claim about the device’s maximum speeds.
Figure out your USB port or device generation number
It can also be useful to know which generation of USB you’re using. I noticed some devices included a specific generation or version number in their name, like “Sandisk 3.0” but it can sometimes be unclear or misleading. Depending on the version of lsusb you’re using, you might be able to see a port’s generation by combing the verbose output, but that can be technically challenging.
If you know how to read speed ratings, checking the generation is actually super simple. Run lsusb -t again, and from the maximum speed a device or port supports, you can also extrapolate what version or generation number the USB port is. Refer to this chart to figure it out:
With hardware’s hard-coded ratings, you can confidently identify its generation, or verify a retailer’s claim about the generation.
The lsusb command isn’t the only useful Linux command in the hardware arena. You can also use the lspci to see info on internal PC components.



Leave A Comment?