Commands To Check USB Devices In Linux Ubuntu Terminal

3 Commands to check USB devices in Linux Ubuntu in command line. This tutorial explains how to find USB drive and how to access USB in Ubuntu Linux terminal.

This post describes how to find the /dev name of my USB device. By default, when a storage device is plugged into the system, it mounts automatically in the /media/ directory.

Detect USB Devices – Find USB Device Name

There are many ways to get the info about USB device and find the name of USB device connected to the system. Before we begin, you must know about the following two basic commands:

1.To see a list of your USB devices (the vendor and device ID’s), run:

lsusb

2. To see information about currently mounted systems, simply run:

mount

1. fdisk Command

fdisk

fdisk is a disk partition manipulation program, which allows you to create, destroy, resize, move and copy partitions on a hard drive using a menu-driven interface.

It is useful for organising the disk space on a new drive, reorganising an old drive, creating space for new operating systems, and copying data to new hard disks. fdisk prints the partition table including any USB drive if present (see screenshot above):

sudo fdisk -l

NOTE: The argument -l, –list shows the partition table on the specified device and exits. If there is no device specified, lists the partition tables on all detected devices.

2. dmesg Command

dmesg

dmesg is used to examine or control the kernel ring buffer. The default action is to display all messages from the kernel ring buffer.

The dmesg command prints or controls the kernel ring buffer, a data structure which stores information about the kernel’s operations.

dmesg

If you want a colorise output, you can use the command with argument -L , it will then colorize the output.

3. lsblk Command

lsblk

lsblk is another command to find the USB device name. The lsblk command lists all the block devices that are attached to the system.

The lsblk command reads the sysfs filesystem and udev db to gather information. The command prints all block devices (except RAM disks) in a tree-like format by default.

lsblk

If you want to list empty devices also, run the command with -a, –all argument. By default the lsblk command doesn’t show empty devices.

You can also use df command to check the Linux disk space utilization alongwith the device name. df displays the amount of disk space available on the file system containing each file name argument.

Original Article