How to List USB Devices Connected to Your Linux System

How do you list the USB devices in Linux?

The question can have two meanings.

  • How many USB ports are (recognized) on your system?
  • How many USB devices/disks are assembled (plugged in) to the system?

Most of the time, people are interested in knowing which USB devices are connected to the system. This can be helpful when troubleshooting the USB devices.

The most reliable way is to use this command:

lsusb

It shows the webcam, bluetooth, and ethernet ports along with the USB ports and the mounted USB drives.

list usb with the lsusb command linux

However, understanding the output of lsusb isn’t easy, and you might not need to complicate things if you just want to see and access the mounted USB drives.

I’ll show you various tools and commands you can use to list USB devices connected to your system.

In the examples, unless otherwise stated, I have connected a 2 GB stick, a 1 TB external hard drive, an Android smartphone via MTP and a USB mouse.

Let me start with the easiest option for desktop users.

Check connected USB devices graphically

Your distribution file manager can be used to view USB storage devices connected to your computer. As you can see in the Nautilus (GNOME File Manager) screenshot below.

The connected devices are displayed in the sidebar (only USB storage devices are displayed here).

Nautilus shows connected USB devices

You can also use GUI applications like GNOME Disks or Gparted to view, format and partition the USB storage devices connected to your computer. GNOME Disks comes pre-installed with GNOME Desktop Environment by default in most distributions.

Read  How to take collective action for racial and gender equity at work

This app also works as a very good partition manager.

Use GNOME Disks to list mounted USB devices

Enough of the graphical tools. Let’s discuss the commands you can use to list the USB devices.

Using the mount command to list the mounted USB devices

The mount command is used to mount partitions on Linux. You can also list USB storage devices using the same command.

Generally, USB storage is mounted in the media directory. So filtering the output of the mount command to media will give the desired result.

mount | grep media

Using the df command

The df command is a standard UNIX command used to determine the amount of disk space available. You can also use this command to list USB storage devices connected with the following command.

df -Th | grep media
Use the df command to list mounted USB drives

Using the lsblk command

The lsblk command is used to list block devices in the terminal. Again, by filtering the output that contains the media keyword, you can get the desired result as shown in the screenshot below.

lsblk | grep media
Using lsblk to list connected USB devicesUsing blkid to list connected USB devices

If you are more curious, you can use those blkid Command to know UUID, label, block size etc.

This command gives more output because your internal drives are also listed. So you need to take references from the above command to identify the device you want to know about.

sudo blkid
Using blkid to list attached USB devices

Using fdisk

fdisk, the good old command line partition manager, can also list the USB storage devices connected to your computer. The output of this command is also very long. Therefore, the connected devices are usually listed below as shown below.

sudo fdisk -l
Use fidsk to list USB devices

Examine /proc/mounts

You can list the USB storage devices by checking the /proc/mounts file. As you can see, it shows you the mount options used by the file system along with the mount point.

cat /proc/mounts | grep media

View all USB devices using the lsusb command

And we revisit the famous lsusb command.

Read  Stress, pressure straining veterinarians needs to be addressed

Linux kernel developer Greg Kroah-Hartman created this handy usbutils utility. This provides us with two commands, ie lsusb and usb-devices for listing USB devices on Linux.

The lsusb command lists all information about the USB bus in the system.

lsusb

As you can see, unlike other commands (which can only list USB storage devices), this command also shows the mouse and smartphone that I have connected.

The second command usb-devices contains more details in comparison but does not list all devices as shown below.

usb-devices

Greg has also developed a small GTK application called Usbview. This application will show you the list of all USB devices connected to your computer.

The application is available in the official repositories of most Linux distributions. You can install usbview Package easily via your distribution’s package manager.

Once installed, you can launch it from the application menu. You can select any of the listed devices to get details as below screenshot shown.

Conclusion

Most of the methods listed are limited to USB storage devices. There are only two methods that can also enumerate other peripherals; usbview and usbutils. I think we have another reason to be grateful to Linux kernel developer Greg for developing these handy tools.

I realize there are many other ways to list USB devices connected to your system. Your suggestions are welcome.


Leave a Comment

Your email address will not be published. Required fields are marked *