Using USB drives for file transfer is so common today, and for those (new Linux users) who prefer to use the command line, learning the different ways to identify a USB device name is very important when you need to format it.

 

Once you attach a device to your system such as a USB, especially on a desktop, it is automatically mounted to a given directory, normally under /media/username/device-label and you can then access the files in it from that directory. However, this is not the case with a server where you have to manually mount a device and specify its mount point.

 

Linux identifies devices using special device files stored in /dev directory. Some of the files you will find in this directory include /dev/sda or /dev/hda which represents your first master drive, each partition will be represented by a number such as /dev/sda1 or /dev/hda1 for the first partition and so on.

$ ls /dev/sda*

 

Find Out Plugged USB Device Name Using df Command

 

To view each device attached to your system as well as its mount point, you can use the df command (checks Linux disk space utilization) as shown in the image below:

$ df -h

 

Use lsblk Command to Find USB Device Name

 

You can also use the lsblk command (list block devices) which lists all block devices attached to your system like so:

$ lsblk

 

Identify USB Device Name with fdisk Utility

 

fdisk is a powerful utility which prints out the partition table on all your block devices, a USB drive inclusive, you can run it will root privileges as follows:

$ sudo fdisk -l

 

Determine USB Device Name with dmesg Command

 

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

 

Run the command below to view kernel operation messages which will as well print information about your USB device:

$ dmesg

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)