Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to identify USB device under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to identify USB devices under Linux, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

If you plug a device into your system, especially in a desktop environment, such as a USB device, it automatically mounts to a specified directory, usually in the/media/username/device-label directory, and you can access those files from there. However, on the server this is not the case, you have to mount the device manually and specify a mount point.

Query USB devices

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

$ ls /dev/sda*

List all device names under Linux

Now let's find out the device name using some special command-line tools.

Use df command to find the inserted USB device name

To see each device inserted into your system and its corresponding mount point, you can use df command in the following figure to check Linux system disk space usage:

$ df -h

Use df command to find USB device name

Use lsblk command to find USB device name

You can also list all block devices inserted into your system using the following lsblk command (List Block Devices):

$ lsblk

List block devices in Linux

Use fdisk tool to identify USB device names

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

$ sudo fdisk -l

List partition tables for block devices

Use the dmesg command to identify USB device names

dmesg is an important command used to print or control kernel ring buffers. A ring buffer is a data structure that holds information about kernel operational data.

Run the following command to view kernel operation information, which also prints USB device information:

$ dmesg

dmesg-Print USB device name

About "how to identify USB devices under Linux" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report