4 Ways to Identify USB Device Names in Linux

Summary: For beginners, one of the techniques you must master in a Linux system is to recognize the various devices plugged into the system. This might be your system hard drive, an external storage device, or a removable device such as a USB device or SD flash card. Nowadays, it is very common to use USB devices to transfer files, for those newbies who like to use the command line, it is very important to learn to use different methods to recognize the USB device name when you need to format the USB device.

image
For beginners, one of the techniques you must master in a Linux system is to recognize the various devices plugged into the system. This might be your system hard drive, an external storage device, or a removable device such as a USB device or SD flash card.

Nowadays, it is very common to use USB devices to transfer files, for those newbies who like to use the command line, it is very important to learn to use different methods to recognize the USB device name when you need to format the USB device.

If you insert a device into the system, especially in a desktop environment, such as a USB device, it will be automatically mounted to a specified directory, usually in the /media/username/device-label directory, and then you can enter the Access those files in the directory. However, this is not the case on the server, you must manually mount the device and specify a mount point.

Linux systems use specific device files in the /dev directory to identify inserted devices. You will find some files in this directory, including /dev/sda or /dev/hda for your first primary device, each partition is represented by a number, such as /dev/sda1 or /dev/hda1 for The first partition of the primary device and so on.

$ ls /dev/sda*

image

lists all device names under Linux system

Now device names using some special command line tools:

Use the df command to find out the name of the inserted USB device To

view each device plugged into your system and its corresponding mount point, you can use the df command in the image below to check the disk space usage of your Linux system:

$ df -h

image
use Use the df command to find USB device names

Use the lsblk command to find USB device names

You can also use the following lsblk command (list block devices) to list all block devices plugged into your system:

$ lsblk
image

List block devices in a Linux system

Use the fdisk tool to identify the USB device name

fdisk is a powerful tool for viewing all partition tables in your system, including all USB devices, execute the following command with root privileges:

$ sudo fdisk -l

image

List block devices Partition Table

Using the dmesg command to identify the USB device name

dmesg is an important command for printing or controlling the kernel ring buffer. A ring buffer is a data structure that stores information for the kernel to manipulate data.

Run the following command to view the kernel operation information, it will also print out the information of the USB device:

$ dmesg

image

dmesg - print the USB device name

The above are all the commands mentioned in this article, we use different methods to find out the USB device name in the command line. You can also share with you other ways to achieve this goal, or if you have any thoughts on this article, you can also share with everyone below.

The article is reprinted from the open source Chinese community [http://www.oschina.net]


Use the Yunqi Community APP, comfortable~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326205250&siteId=291194637