1. Overview

Knowing the USB version supported by the USB slots or ports present in a system can be crucial. Depending on the USB version, the data transfer rate can vary significantly.

For example, a USB 3.0 flash drive plugged into a slot that supports USB 3.0 in a system can facilitate a much faster transfer rate than a USB 3.0 flash drive in a slot that only supports USB 2.0. Thus, knowing the USB slot version can help us estimate the data transfer rate and troubleshoot device compatibility issues.

In this tutorial, we’ll explore three methods to find the USB slot version in Linux.

2. Using lshw

The lshw tool provides a complete overview of the hardware components of a system, including the storage devices, network adapters, CPU, and USB controllers. Furthermore, it can generate a detailed report on a specific hardware component in HTML or XML format.

We can install the lshw tool in Debian-based systems using the apt command from the Linux terminal:

$ sudo apt-get install lshw

Now, let’s run the the lshw tool:

$ sudo lshw
sam-hp-laptop-15q-ds1xxx    
    description: Notebook
    product: HP Laptop 15q-ds1xxx (6EW00PA#ACJ)
    vendor: HP
    version: Type1ProductConfigId
    serial: CND8515GN0
    width: 64 bits
    capabilities: smbios-3.0.1 dmi-3.0.1 smp vsyscall32
    configuration: administrator_password=disabled boot=normal chassis=notebook family=103C_5335KV HP Notebook sku=6EW00PA#ACJ uuid=474e6ed6-c005-e911-a4c3-e4e749c198c1
  *-core
       description: Motherboard
       product: 8532
       vendor: HP
       physical id: 0
       version: 70.31
       serial: PHRXHD41UBPT8R
       slot: Type2 - Board Chassis Location
*-cpu
          description: CPU
          product: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
          vendor: Intel Corp.
          serial: To Be Filled By O.E.M.
          slot: U3E1
          size: 3271MHz
          capacity: 3900MHz
          clock: 100MHz
...output truncated...

We use the sudo command to run commands with administrative privileges.

Thus, lshw employs the elevated privileges to extract and output information from the hardware components in a system. Now, let’s display the information about the USB component:

$ sudo lshw -class usb
description: USB controller
             product: Cannon Point-LP USB 3.1 xHCI Controller
             vendor: Intel Corporation
             physical id: 14
             bus info: pci@0000:00:14.0
             version: 30
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi xhci cap_list
             configuration: driver=xhci_hcd latency=0
             resources: irq:125 memory:a1400000-a140ffff
           *-usbhost:0
                product: xHCI Host Controller
                vendor: Linux 5.15.0-82-generic xhci-hcd
                physical id: 0
                bus info: usb@1
                logical name: usb1
                version: 5.15
                capabilities: usb-2.00
                configuration: driver=hub speed=480Mbit/s
           *-usbhost:1
                product: xHCI Host Controller
                vendor: Linux 5.15.0-82-generic xhci-hcd
                physical id: 1
                bus info: usb@2
                logical name: usb2
                version: 5.15
                capabilities: usb-3.10
                configuration: driver=hub speed=10000Mbit/s

The output provides several pieces of information about the USB controller and available USB slots:

  • product name
  • physical identity number
  • vendor information
  • USB bus location
  • version of USB host
  • USB slot version
  • maximum transfer speed of each of the available USB slots

In this case, there are two USB slots present in the system. Specifically, the first USB slot supports a maximum transfer speed of 480 Mbit/s (megabits per second) and is compatible with the USB 2.0 version. On the other hand, the second USB slot supports the USB 3.0 version and facilitates a higher transfer rate.

3. Using usb-devices

Alternatively, we can use the usb-devices tool to get data about the USB devices and controllers attached to a system. In particular, it’s mainly utilized to extract detailed information about the configurations, capabilities, and attributes of USB devices.

Furthermore, the usb-devices tool is a part of the usbutils package in Linux. Therefore, to get the usb-devices tool, we install the usbutils package:

$ sudo apt-get install usbutils

After a successful installation, let’s run the usb-devices tool:

$ usb-devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh=12
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=05.15
S:  Manufacturer=Linux 5.15.0-82-generic xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:00:14.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=10000 MxCh= 6
D:  Ver= 3.10 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev=05.15
S:  Manufacturer=Linux 5.15.0-82-generic xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:00:14.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

The output provides various details:

  • bus identity
  • maximum transfer speed
  • USB version
  • product details
  • configuration

As we can see, there are two USB slots present in the system. One slot supports USB 2.0, while the other one is compatible with USB 3.0.

4. Using hardinfo

Another alternative for finding the USB slot version in Linux is to use the hardinfo tool. In particular, it offers a graphical interface for viewing various information about system configurations and hardware components.

Let’s install the hardinfo tool on our Debian-based system:

$ sudo apt-get install hardinfo

After successfully installing it, we can launch hardinfo from the terminal:

$ hardinfo

Let’s take a glimpse at the main screen of the tool:

Main screen of the hardinfo tool

Now, we go to Devices and click on the USB Devices option:

USB devices details on the hardinfo tool

Finally, we can see the number of USB slots present in the system, along with the supported USB version.

5. Identifying Physical USB Slots

At this point, we know the number of USB slots present in the system and the USB slot version. However, we still haven’t identified the actual physical slots with their supported USB version.

To distinguish the USB slots present in the system, we can utilize the hardinfo tool. By default, the USB slot that supports USB 2.0 is connected to bus 1, and the USB slot that supports USB 3.0 is connected to bus 2.

Now, let’s insert a USB 3.0 flash drive into any of the USB slots. Furthermore, we launch the hardinfo tool and navigate to the USB Devices tab:

Identifying the physical USB slot version

Here, we can see that the USB flash drive is attached to the USB slot which supports USB 2.0. In addition to this, we can identify the USB slot via its bus number.

Due to the compatibility issue of the USB slot, the USB version of the inserted flash drive is displayed as USB 2.0. However, the optimal version of the USB flash drive in this case is USB 3.0.

6. Conclusion

In this article, we discussed three methods to find the USB slot version in Linux.

First, we saw lshw, a command-line tool that provides a complete overview of the hardware components of a system. On the other hand, usb-devices is another command-line tool that only provides information regarding the USB controllers and devices connected to the system.

Furthermore, the hardinfo tool is similar to the lshw tool in terms of functionality but offers a graphical user interface for viewing information about the hardware components in a system.