Linux get all usb devices

Linux: How do I list all USB devices?

Q. How do I list all USB devices connected to my computer / Linux laptop?

A. You need to use command called lsusb. It is a utility for displaying information about USB buses in the system and the devices connected to them under Linux kernel.

lsusb – list USB devices

To make use of all the features of this program, you need to have a Linux kernel which supports the /proc/bus/usb interface (e.g., Linux kernel 2.3.15 or newer).
$ lsusb
Output:

To get verbose output type the command:
$ lsusb -v

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

Hi im new into reading unsupported usb devices on linux and I have a question to ask, after that whats the next step to do? how can I read the raw data (if thats the right way to call it like that), and what type of applications can I use to getting the data… Any help I will apreciate it. BTW Im trying to getting the pictures of a Disney Jonas Brother Digital Still Camera or use it like a webcam or something else like controlling when to take pictures, you know the usual stuff.

Hi there, how would I go about determining the port number of a specific USB device?

with an older zonet bluetooth dongle not showing in lsusb or errors in dmesg how can I tell if there are any interactions when plugged? (Mint 15 64bit mate)

If the device has been formatted and given a path on the system, then typing “df” will show the device/path on the list. If you unplug it and type “df” again, then compare the two lists, you can see which one it is.

Источник

How to List USB Devices in Linux

Nowadays, many computer peripherals such as webcams, mice, scanners, printers, hard drives, USB (Pendrive) now come as USB devices. Once these devices are connected to the Desktop or server it’s important to know the device name or device path. This helps to identify USB devices for the tasks such as formatting.

In Linux, all device files are stored in /dev directory and must be available to the OS during the system boot.

In this tutorial, I will show you the various ways to list USB devices on Linux. Most commands mentioned here should work on all Linux distributions.

List USB Device Names Using df Command

The df command is a useful command that can help list all mounted volumes, including your USB drives.

Once a USB device is plugged into a Linux system especially for Desktop, it is automatically mounted in the /media partition and becomes ready for use.

From the output above, I have 1 USB drive /dev/sdb with 2 partitions /dev/sdb1 and /dev/sdb2

List USB Device Name using lsblk Command

Lsblk command is used to list all block devices on a Linux system. From the list, you can filter USB devices using the grep command.

To retrieve additional information such as the UUID, manufacturer and filesystem type, use the blkid command as shown.

List USB Device Names Using fdisk Command

You can use the good old fdisk command that is used for partitioning volumes to list all the partitions on the Linux system, including the USB drives.

The comman will display detailed information about your USB volume including the partitions, size of the volume , sectors and the filesystem type.

List USB Devices Details using lsusb Command

The lsusb command, also known as the “List USB” command, is used in Linux to list all the USB devices attached to the system.

The output above displays the Bus ID, Device ID, USB ID, and the vendor or manufacturer of the USB devices

The lsusb command simply lists the connected devices and does not provide further information about the usb devices.

For more information about the attached USB devices use the dmesg command. The dmesg command also known as “driver message” or “display the message” is used for examining the boot messages. Additionally, it is used for debugging hardware-related issues and printing messages generated by device drivers.

You can use the dmesg command and grep to narrow down to USB devices.

Also, you can pipe the output of dmesg command to less for easier scrolling.

On the output, you can search for a specific string by pressing the forward slash key ( / ) on your keyboard followed by the name or Device ID of the USB device.

In my case, I’m searching for more information regarding a USB device called SanDisk, which is actually my removable pen drive.

List USB controllers and devices using usb-devices

The usb-devices command is a shell script that allows you to list all the USB controllers and the USB devices connected to your PC. It prints out details of the USB device such as the manufacturer, product name, serial number, and so much more. Here’s the output of the command:

usb-devices command to list usb devices

Conclusion

In this tutorial, we have demonstrated different ways to list the USB devices attached to the Linux system.

Источник

Как в Linux посмотреть подключенные USB устройства

В настоящее время многие компьютерные периферийные устройства, такие как веб-камеры, мыши, сканеры, принтеры, жесткие диски, USB (Pendrive) подключаются по USB. После того, как эти устройства подключены к рабочему столу или серверу, важно знать имя устройства или путь к нему. Это помогает идентифицировать USB устройства для таких задач, как форматирование или отключение.

В Linux все файлы устройств хранятся в каталоге /dev и должны быть доступны во время загрузки системы.

В этой статье я покажу вам различные способы как в ubuntu посмотреть usb устройства. Большинство команд, упомянутых здесь, должны работать практически на всех дистрибутивах Linux. Например Ubuntu, Debian, Mint.

Просмотр списка имен USB устройств с помощью команды df

Команда df — это полезная команда, которая может помочь составить список всех подключенных томов, включая USB-накопители.

Как только USB-устройство подключается в систему Linux, это устройство автоматически монтируется в раздел /media и становится готовым к использованию.

Из приведенного выше вывода следует, что у меня есть 1 USB-накопитель /dev/sdb с 2 разделами /dev/sdb1 и /dev/sdb2

Список имен подключенных USB — устройств с помощью команды lsblk

Команда Lsblk используется для перечисления всех блочных устройств в системе Linux. Из списка можно фильтровать USB-устройства с помощью команды grep.

Чтобы получить дополнительную информацию, такую как UUID, производитель и тип файловой системы, используйте команду blkid, как показано на рисунке ниже.

Список USB — устройств с помощью команды fdisk

Вы можете использовать старую добрую команду fdisk, которая используется для разбиения томов на разделы, чтобы перечислить все разделы в системе Linux, включая USB-накопители.

Запятая будет отображать подробную информацию о вашем USB-томе, включая разделы , размер тома, секторы и тип файловой системы.

Список сведений о подключенных USB-устройствах с помощью команды lsusb

Команда lsusb, также известная как команда “List USB”, используется в Linux для перечисления всех USB-устройств, подключенных к системе.

На выводе выше отображается идентификатор шины, идентификатор устройства, идентификатор USB, а также поставщик или производитель USB-устройств

Команда lsusb перечисляет подключенные устройства и не предоставляет дополнительной информации о USB-устройствах.

Для получения дополнительной информации о подключенных USB устройствах используйте команду dmesg. Команда dmesg, также известная как “сообщение драйвера” или “показать сообщение”, используется для проверки загрузочных сообщений. Кроме того, эта команда используется для отладки проблем, связанных с оборудованием и печати сообщений, генерируемых драйверами устройств.

Вы можете использовать команду dmesg и grep, чтобы сузиться до USB-устройств.

Кроме того, вы можете передать вывод команды dmesg в less для облегчения прокрутки.

На выходе вы можете найти определенную строку, нажав клавишу прямой косой черты ( / ) на клавиатуре, а затем имя или идентификатор устройства USB-устройства.

В моем случае я ищу дополнительную информацию о USB устройстве под названием SanDisk.

Поиск USB-накопителя

Список USB контроллеров и устройств, использующих USB устройства

Команда usb-devices-это сценарий оболочки, который позволяет вам перечислить все USB-контроллеры и USB-устройства, подключенные к вашему компьютеру. Он печатает детали USB-устройства, такие как производитель, название продукта, серийный номер и многое другое. Вот вывод команды:

Заключение

В этой статье мы продемонстрировали различные способы просмотра USB-устройств, подключенных к системе Linux.

Источник

List USB Devices Linux

In the world of USB computer peripherals, almost everyone uses some sort of USB devices in their computer. These days there are USB webcams, USB hard drives, USB stick also known as PenDrive etc. Almost every device has a USB version of it. So if you’re using Linux, listing what USB device is connected to your system might be necessary at some point.

There are many programs and many ways to list USB devices on Linux.

In this article, I will show you how to list USB devices on Linux. I am using Ubuntu 18.04 Bionic Beaver for the demonstration, but these commands are available on every Linux distribution. So let’s get started.

Listing USB Devices using lsusb Command

The widely used lsusb command can be used to list all the connected USB devices in Linux.

As you can see from the output of the lsusb command in the screenshot below, all the connected USB device is listed. The Bus ID, Device ID, USB ID, and a title is displayed in the output of lsusb command.

As you can see in the marked section of the screenshot below, Realtek Semiconductor Corp. with ID 0bda:57cb, this is my USB Webcam.

You can’t tell that it’s a Webcam by looking at the output of lsusb command, Can you? Nope! So how do I know this? It’s because I checked the output of the lsusb command before and after connecting the USB Webcam and once I compared the outputs, the newly added row is the USB device I connected. Plain! But there are ways to find out what the USB device is.

You can use the dmesg command to find out more information about the connected USB devices. The last connected USB device is the easiest to find with dmesg command. It is more widely used for debugging purpose. You will shortly see why.

You run dmesg command as follows:

As you can see in the yellow marked box in the screenshot below, these are information about the USB device I connected last, which was my USB Webcam. You can see in one of the blue marked box, the USB device I connected is a HD UVC WebCam and its ID is 0bda:57cb.

By now you may have found out that the output of dmesg command is system log messages. Well yes, it is.

You can also search for a specific USB device by its ID in the dmesg system log.

Run the following command to open the output of dmesg command with less text pager:

You should see the following window:

Now to search for a string, press / key on your keyboard. And you should the a / appear on the bottom of terminal window as marked in the screenshot below.

Now type in the USB device ID. For example, earlier when I listed the connected USB devices with lsusb command, one of the USB device had ID 0bda:57cb

Type in the USB Device ID and press . As you can see in the marked section of the screenshot below, the search string is marked white.

You may press and arrow keys to navigate up and down and read through it. You should find a lot of information about that USB device as you can see in the marked section of the screenshot below.

Listing USB devices with usb-devices Command

You can run the following command to list all the connected USB devices of your system:

As you can see in the screenshot below, all the connected USB devices are listed. we can find out pretty much the same information as before with usb-devices command.

Listing Block USB Devices

If you want to list all the USB block storage devices, that is all the USB storage devices, then you can use the lsblk or fdisk command to do so.

Listing USB block storage devices with lsblk:

As you can see in the screenshot below, all the available block storage devices (including the USB block storage devices) are listed.

You can get almost the same information as lsblk command with blkid command. But you have to run it as root as follows:

You can also use fdisk command to list all the USB block storage devices as follows:

As you can see in the screenshot below, the connected block storage devices (including the USB devices) are listed.

That’s how you list all the USB devices on Linux. Thanks for reading this article.

Источник

Читайте также:  Как установить windows с флешки для чайников
Оцените статью