As a newbie, one of the many things you should master in Linux is identifying the devices attached to your system. It could be your computer’s hard disk, an external hard drive, or removable media such as a USB drive or an SD memory card.
Using USB drives for file transfer is super common these days, and for those (new Linux users) who prefer using the command line, learning how to identify a USB device name is really important, especially when you need to format it.
Once you attach a device to your system, like a USB, it’s usually auto-mounted to a directory, normally under /media/username/device-label
. From there, you can access its files just like any other folder. However, this isn’t the case with a Linux server. In server environments, you typically need to manually mount a device and specify its mount point.
Linux identifies devices using special device files located in the /dev
directory. Some common ones you’ll find include /dev/sda
or /dev/hda
, which represents your primary (master) drive. Each partition on the drive is represented by a number, for example, /dev/sda1
or /dev/hda1
for the first partition, and so on.
ls /dev/sda*

Now, let’s check out a few command-line tools you can use to identify USB device names:
1. Find Out Plugged USB Device Name Using df Command
To see each device attached to your system along with its mount point, use the df command (which checks disk space usage):
df -h

2. Use lsblk Command to Find USB Device Name
The lsblk command (list block devices) shows all block devices attached to your system:
lsblk

3. Identify USB Device Name with fdisk Utility
fdisk is a powerful tool that prints the partition table of all block devices, including USB drives.
sudo fdisk -l

4. Determine USB Device Name with dmesg Command
dmesg is an important command that prints kernel messages, which include details about USB devices when they’re plugged in.
dmesg

That’s all for now! In this article, we’ve covered several different ways to find the name of a USB device from the command line.
If you know other methods or have any thoughts to share, feel free to drop them in the comments below.
the only useful tip is to look at dmesg.
When i plug in USB device in Linux, its not detecting anything. Can we have solution for this?
I still have no idea how to make sure by winchester external drive is the right one. I thought I had it and then formatted my main computer drive by mistake. That was a problem.
@Jim
You can always identify drives or partitions by their file system type, size as well mount points, however, taking some time to understand naming of storage media under /dev virtual file system will help you avoid such mistakes in the future.
What I need is a name like /dev/somename for a device that is NOT a mass storage device. No luck yet.
I did try lsusb, ls /dev/*, df -h, lsblk, sudo fdisk -l.
These are all for mass storage devices like memory sticks, camera card readers or external HD
Then I tried also usb-devices which lists other devices too, like mouse, printer etc, But it gives some bus number and some device number, no /dev name
The reason is that I tried to install the “Samsung unified linux driver” which asks me for the device name of my printer. Unfortunately the names it proposes are crap since they do not exist on my machine !
They propose /dev/mft4 up to /dev/mft11. None of these do exist…
I let it do with /dev/mft4 with a bad presentiment.
So finally the installation software affirmed that the driver has been successfully installed and when I click on “testprint” it says that the device can not be found. Of course…
Still no solution in sight !
@Daniel
Try to contact the developers of Samsung unified linux driver for any assistance. However, once we find a solution, we will share it with you.
Some of us use external USB-connected drives as system-wide storage. I, for one, would like to mount those file systems elsewhere than /media/{username}. Also, I’d like to use a standard name for some “media” drives instead of a changing label or UUID identifier.
For example, the flash storage from my digital camera, I’d like to mount as “…/camera” regardless of the label/UUID.
Consider an article that explains how to accomplish that.
@Dan St-Andre
We’ll work on an article concerning such a scenario. Thanks for the feedback.
What about USB devices that are not for data storage? Cameras, humidity sensors, A-D converters, all kinds of tools for monitoring the physical world.
@Joe
Very good question, as of now, we can not tell how that can be done, since we have not dealt with the devices you are talking about. However, we will definitely look for more information concerning this question and find relevant ways or command line tools for listing or identifying such(Cameras, humidity sensors, A-D converters, all kinds of tools for monitoring the physical world) USB devices.
Thanks for getting in touch.
consider ‘lsusb {options}’
@Dan St-Andre
Cool, we’ll test this for the above purpose. Thanks.
We can also use lsblk and parted.
Fix typo: lsblk => blkid
Typo noted, we shall check out blkid and include it in the article. Many thanks for the info.
@Ren
lsblk has been included in the article, we shall test parted and include it in the article as well.Thanks for the useful feedback.
This commands listed will only deal with block devices.
For simplicity and to find ALL USB devices try “lsusb -v”. This will tell you everything you need to know about any USB device.
@Bruce
lsusb -v is a good command, however, it can work well for advanced users. Newbies may not find its output easy to understand, but it offers more in-depth information about USB devices. Above all. thanks for informing us, we will add it to the list above.