1. Home
  2. Linux
  3. Ubuntu list usb devices

Ubuntu: list USB devices

On Ubuntu, you may (for one reason or another) wish to view information about all USB devices connected to the system. Unfortunately, Ubuntu doesn’t come with an official GUI USB tool that users can use to view this information efficiently.

Ubuntu: list USB devices

Thankfully, there are many command-line utilities that users can take advantage of to view USB device information. In this guide, we’ll go over each of these tools, how they work, and how to use them.

Ubuntu list USB devices – Lsusb

The number one way an Ubuntu user can view all connected USB devices is with the lsusb command. This command literally means “list USB,” and it does exactly that — it lists all of your USB devices, their IDs, names, etc.

To get started, open up a terminal window on the Ubuntu desktop. To open up a terminal window on Ubuntu, press Ctrl + Alt + T on the keyboard. Or, search for “Terminal” in the app menu and launch it that way.

With the terminal window open and ready to use, execute the lsusb command in the terminal window. Once you enter it, it will print out detailed information about the USB devices connected to the system.

lsusb

In the lsusb output, you’ll see “Bus,” followed by numbers, “Device,” more numbers, “ID,” some hex code (that’s your device’s ID code), and the name of the device. To locate any USB device, find the name at the end.

If you’d like to save this output to a text file for later reading, research, or easier viewing via your favorite text editor, pipe the output to a file using the > command-line modifier. 

lsusb > ~/my-usb-devices.txt

At any time, you can view the “my-usb-devices.txt” file in the terminal with the cat command below.

cat ~/my-usb-devices.txt

Or, open up the text file in your home folder using your favorite text editor.

Ubuntu list USB devices – Dmesg

Another way to view USB devices on Ubuntu is with the dmesg command. The dmesg tool is used primarily to view kernel logs on your system. As USB devices interact with your Ubuntu system, they’re talking to the Ubuntu Linux kernel, which means their information is in these logs.

To use dmesg, you must first open up a terminal window. To do this, press Ctrl + Alt + T  on the Ubuntu desktop. Alternatively, search for “Terminal” in the app menu and launch it that way.

When the terminal window is open and ready to use, enter the dmesg command below with sudo privileges. Sadly, the Ubuntu Linux kernel logs cannot be viewed without root access, as dmesg interacts with system-level stuff.

sudo dmesg | grep usb

You’ll see an output of all USB-related information that has interacted with the Ubuntu kernel by entering this command. From here, use the output to find information on your USB devices.

Want to save the dmesg output to a text file for later reading, or to view it better in your favorite GUI text editor? Using the command below, redirect the output to a text file.

sudo dmesg | grep usb > ~/dmesg-usb-info.txt

With it redirected, you can view the text file using the cat command below. Or by opening up “dmesg-usb-info.txt” in your favorite text editor.

cat ~/dmesg-usb-info.txt

Ubuntu list USB devices – Usb-devices

A third way you can view USB device information on the Ubuntu desktop is with the usb-devices command. It is similar to the lsusb tool. However, it is a bit more intricate and provides a lot more information in a much more organized way.

To start, you must have a terminal window open up on the Ubuntu desktop. To open up a terminal window on the desktop, press Ctrl + Alt + T on the keyboard. Or, search for “Terminal” in the app menu and launch it.

With the terminal window open and ready to go, execute the usb-devices command. The output is long and prints out in detail, every single USB device connected to Ubuntu in a vertical list.

In this list, you’ll see several columns. T, D, P, S, S, S, C, and I. Each of these letters has tons of information about your devices. For example, to find out the vendor info of a connected USB, go to “P” and read the vendor and product info, etc.

To save the output of the usb-devices command to your Ubuntu system for later reading, or to access via your favorite GUI text editor, you can pipe the output using >

usb-devices > ~/my-usb-devices-output.txt

At any time, if you want to view the “my-usb-devices-output.txt” file on your computer, execute the cat command below. Alternatively, double-click on “my-usb-devices-output.txt” in the Ubuntu file manager to view it in your favorite text editor.