- lsusb command in Linux with Examples
- Find USB device details in Linux/Unix using lsusb command
- What is USB?
- Learn lsusb command with examples
- lsusb(8) — Linux man page
- Synopsis
- Description
- Options
- Return Value
- What is lsusb in linux
- Примеры использования
- Вывод списка USB-устройств
- Вывод подробной информации о USB-устройствах
- Вывод информации о заданных USB-шинах и устройствах
- How to use lspci, lsscsi, lsusb, and lsblk to get Linux system devices information
- 1) What’s lspci – List PCI Bus Devices
- How to install lspci
- lspci Usage
- 2) What’s lsscsi – List scsi Devices
- How to install lsscsi
- lspci Usage
- 3) What’s lsusb – List USB buses and device
- How to install lsusb
- lsusb Usage
- 4) What’s lsblk – List block devices
- How to install lsblk
- lsblk Usage
lsusb command in Linux with Examples
The lsusb command in Linux is used to display the information about USB buses and the devices connected to them. The properties displayed are speed, BUS, class, type details, etc.
Syntax:
Example:
Options:
-s : This option is used to display the only device specified by the bus and/or device number.
Example:
-t : This option is used to dump the physical USB device hierarchy as a tree.
Example:
-D : This option is used to display information about the specified device file. The device file should be like /dev/usb/002/004.
Источник
Find USB device details in Linux/Unix using lsusb command
Today we will see how to list USB devices in Linux and their properties such as speed, BUS, class, type details etc. This is part of our on going hardware detection series. We already covered following stuff.
What is USB?
USB( Universal Serial Bus) is a stranded developed to replace different types of BUS’s available. This is a solution devices to eliminate vendor lock-down of hardware ports, so that BUS’s will be identical across different devices from different vendors. USB devices solve one more problem i.e. speeds. USB devices can reach up 5GB/s as of this writing where as PCI and serial devices have less speeds. Depending of USB firmware, it’s categorize in to USB 1.0, USB 2.0, USB 3.0. USB have competitor in the from of Thunderbolt interface.
As a Linux User/administrator we should know USB bus details as well as devices connected. In this post we will see how to use lsusb command to display different USB properties.
Learn lsusb command with examples
Example 1: List all the USB ports available
Let us try to understand above output in detail.
Bus 002 Device 003 : ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 002 : This is bus number where SanDisk USB stick is attached.
Device 003 : This is the third device attached to bus 002, the other two devices are “Linux Foundation 2.0 root hub” and ” Intel Corp. Integrated Rate Matching Hub”
ID 0781:5567 is the number given to this SanDisk, The number before : indicates the manufacture ID and number after : indicates device ID. To get more info on this visit Linux-USB site.
SanDisk Corp. Cruzer Blade is the name of manufacture and device name.
Example 2: Check how many USB ports available in your machine so that we can connect USB devices to these ports.
These ports may be internal or external to the system.
Example : Get detailed information of a USB device connected to a machine. Suppose I want to see information about /dev/bus/usb/002/005 device use below command
Output:
To know each of these types, click here.
Example 3: Get all the USB ports available and devices connected using verbose mode.
Example 4: List all mass storage devices in your system.
From the above output we can find that there are total three USB storage devices present on the machine.
Example 5: Find USB devices protocol version.
Depending on the version, the speed varies. Below table give you clear idea about the speeds associated with these versions.
USB 1.10 | 12Mb/s |
USB 2.00 | 480Mb/s |
USB 3.00 | 5Gb/s |
Example 6: Find USB device supported speeds by using tree structure option
In our next post we will see other hardware device properties.
Источник
lsusb(8) — Linux man page
lsusb — list USB devices
Synopsis
Description
lsusb is a utility for displaying information about USB buses in the system and the devices connected to them.
Options
-v, —verbose Tells lsusb to be verbose and display detailed information about the devices shown. This includes configuration descriptors for the device’s current speed. Class descriptors will be shown, when available, for USB device classes including hub, audio, HID, communications, and chipcard. -s [[bus]:][devnum] Show only devices in specified bus and/or devnum. Both ID’s are given in decimal and may be omitted. -d [vendor]:[product] Show only devices with the specified vendor and product ID. Both ID’s are given in hexadecimal. -D device Do not scan the /dev/bus/usb directory, instead display only information about the device whose device file is given. The device file should be something like /dev/bus/usb/001/001. This option displays detailed information like the v option; you must be root to do this. -t
Tells lsusb to dump the physical USB device hierarchy as a tree. This overrides the v option. -V, —version Print version information on standard output, then exit successfully.
Return Value
If the specified device is not found, a non-zero exit code is returned.
Источник
What is lsusb in linux
Команда lsusb позволяет задействовать одноименную утилиту, предназначенную для вывода информации о USB-шинах и подключенных к ним устройствах. Каждое из устройств имеет пару 16-битных идентификаторов: идентификатор производителя (Vendor ID) и идентификатор устройства (Device ID), которые следует использовать для идентификации устройств и поиска драйверов в случае их отсутствия в ядре ОС, а также несколько дополнительных идентификаторов, устанавливаемых производителем. В составе дистрибутивов Linux имеется файл базы данных устройств, содержащий названия устройств с известными идентификаторами. Данная команда крайне полезна для идентификации и диагностики устройств компьютера. Она выводит результаты в формате списка, который может фильтроваться с помощью утилиты grep.
Базовый синтаксис команды выглядит следующим образом:
Утилита может вызываться как без параметров, так и с ними. Наиболее полезными параметрами являются параметр -t, предназначенный для вывода информации в древовидном формате, параметр -v для вывода подробной информации об устройствах, а также параметры -s и -d для вывода информации об устройствах на заданных шинах и с заданными идентификаторами соответственно.
Примеры использования
Вывод списка USB-устройств
Для вывода списка USB-устройств достаточно использовать утилиту без каких-либо параметров. Прав суперпользователя для выполнения команды не требуется.
$ lsusb
Bus 002 Device 005: ID 12d1:1436 Huawei Technologies Co., Ltd. Broadband stick
Bus 002 Device 003: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter
Bus 002 Device 002: ID 214b:7250 USB2.0 HUB
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 0000:3821 SiliconWin mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 04f3:0103 Elan Microelectronics Corp. ActiveJet K-2024 Multimedia Keyboard
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Вывод имеет строго регламентированную структуру. По сути, параметры устройств разделены пробелами. Возьмем последнюю строку в качестве примера:
- Номер шины: Bus 003
- Номер устройства на шине: Device 001
- Идентификаторы производителя и устройства: 1d6b:0001
- Название устройства: Linux Foundation 1.1 root hub
Несложно убедиться, что все строки имеют схожий формат. При этом в списке отражена информация как об обычных USB-устройствах (таких, как клавиатуры и мыши), так и о специализированных устройствах (таких, как хабы).
Вывод подробной информации о USB-устройствах
Для того, чтобы вывести подробную информацию о USB-устройствах, следует использовать комбинацию параметр -v:
$ lsusb -v
…
Bus 002 Device 003: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter
Couldn’t open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.01
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x148f Ralink Technology, Corp.
idProduct 0x7601 MT7601U Wireless Adapter
bcdDevice 0.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x004a
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 160mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 8
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x08 EP 8 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x06 EP 6 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x07 EP 7 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x09 EP 9 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
…
Данный вывод является крайне обширным и содержит огромное количество параметров конфигурации USB-устройств. Он может использоваться для диагностики и идентификации устройств, причем в случае исполнения команды от лица суперпользователя, информации будет еще больше (обратите внимание на предупреждение в начале вывода).
Вывод информации о заданных USB-шинах и устройствах
Для того, чтобы вывести информацию о заданной USB-шине и устройствах на ней достаточно использовать параметр -s и передать утилите идентификатор интересующей шины:
$ lsusb -s 003:
Bus 003 Device 002: ID 04f3:0103 Elan Microelectronics Corp. ActiveJet K-2024 Multimedia Keyboard
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Или шины и устройства:
$ lsusb -s 003:002
Bus 003 Device 002: ID 04f3:0103 Elan Microelectronics Corp. ActiveJet K-2024 Multimedia Keyboard
При использовании лишь идентификатора шины следует использовать двоеточие в конце идентификатора.
Что касается информации об устройствах, то совместно с параметром -d может использоваться как идентификатор производителя:
$ lsusb -d 04f3:
Bus 003 Device 002: ID 04f3:0103 Elan Microelectronics Corp. ActiveJet K-2024 Multimedia Keyboard
Так и идентификатор устройства:
$ lsusb -d :0103
Bus 003 Device 002: ID 04f3:0103 Elan Microelectronics Corp. ActiveJet K-2024 Multimedia Keyboard
Не стоит забывать о двоеточии, которое указывает на используемый идентификатор: идентификатор производителя должен иметь двоеточие в конце, идентификатор устройства — в начале.
Источник
How to use lspci, lsscsi, lsusb, and lsblk to get Linux system devices information
There are many utilities available to check Linux system hardware information. Some commands report altogether like CPU, Processor, memory, storage, disk, etc,. and the rest will cover only specific hardware components like CPU or processor or memory, etc,.
In this tutorial we are going to cover about Linux System Devices Information utilities such as lspci, lsscsi, lsusb, and lsblk.
- lspci: List PCI Bus Devices
- lsscsi: List scsi Devices
- lsusb: List USB buses and device
- lsblk: List block devices
This tutorial takes a quick look at some of the most commonly used commands to check information and configuration details about various hardware devices.
1) What’s lspci – List PCI Bus Devices
lspci stands for list PCI devices. lspci command is used to display information about PCI buses in the system and hardware devices that are connected to PCI and PCI bus.
It will display information about model number/chip details for devices like PCI bridge, VGA controller, Ethernet controller, USB controller, Audio device, IDE interface, etc.
lspci doesn’t come stand alone utility and its part of the pciutils package.
By default, it shows a brief list of devices which are attached in the system, so filter out specific device information with grep for better view.
How to install lspci
pciutils is available in distribution official repository so, we can easily install through distribution package manager.
For Debian/Ubuntu , use apt-get command or apt command to install pciutils.
For RHEL/CentOS , use YUM Command to install pciutils.
For Fedora , use dnf command to install pciutils.
For Arch Linux , use pacman command to install pciutils.
For openSUSE , use Zypper Command to install pciutils.
lspci Usage
Just run the following command to get the PCI device information.
To display the detailed information of all the PCI devices
To display the subsystem information.
2) What’s lsscsi – List scsi Devices
lsscsi stands for list small Computer System Interface. The lsscsi command lists information about SCSI/Sata devices attached to the system.
It scans the sysfs (mounted at /sys) pseudo file system to gather information, which was introduced in the 2.6 Linux kernel series.
How to install lsscsi
lsscsi is available in distribution official repository so, we can easily install through distribution package manager.
For Debian/Ubuntu , use apt-get command or apt command to install lsscsi.
For RHEL/CentOS , use YUM command to install lsscsi.
For Fedora , use dnf command to install lsscsi.
For Arch Linux , use pacman command to install lsscsi.
For openSUSE , use Zypper Command to install lsscsi.
lspci Usage
Just run the following command to get the SCSI device information.
3) What’s lsusb – List USB buses and device
lsusb stands for list Universal Serial Bus or USB. It’s display information about USB buses in the system and the devices connected to them. This will display a list of all USB devices connected to your computer such as keyboards, mouse, printers, disk drives, network adapters, etc.
lsusb doesn’t come stand alone utility and its part of the usbutils package.
How to install lsusb
lsusb is available in distribution official repository so, we can easily install through distribution package manager.
For Debian/Ubuntu , use apt-get command or apt command to install lsusb.
For RHEL/CentOS , use YUM command to install lsusb.
For Fedora , use dnf command to install lsusb.
For Arch Linux , use pacman command to install lsusb.
For openSUSE , use Zypper Command to install lsusb.
lsusb Usage
Just run the following command to get the USB device information.
Details:
- Bus 002: Which bus the device is attached
- Device 005: It’s attached as fifth device
- ID 04b3:4010: It’s device identification number
- IBM Corp: Manufacture Name
4) What’s lsblk – List block devices
lsblk stands for list block devices. It’s display information about block devices (except RAM disks). Block devices are hard disk partition, flash drives, CD-ROM, optical drives, etc,.
lsblk is part of the util-linux package. It’s collection of basic system utilities that contains a large variety of low-level system utilities that are necessary for a Linux system to function.
How to install lsblk
lsblk is available in distribution official repository so, we can easily install through distribution package manager.
For Debian/Ubuntu , use apt-get command or apt command to install lsblk.
For RHEL/CentOS , use YUM command to install lsblk.
For Fedora , use dnf command to install lsblk.
For Arch Linux , use pacman command to install lsblk.
For openSUSE , use Zypper Command to install lsblk.
lsblk Usage
Just run the following command to get the block device information.
Details:
- NAME: Device Name listed here
- MAJ:MIN: Shows major and minor device number
- RM: Shows whether the device is removable or not
- SIZE: Dispaly size of the device
- RO: Display if the device is read-only
- TYPE: Display about device type such as disk, partition, lvm, etc.,
- MOUNTPOINT: Dispaly where the device is mounted
To List Device Permissions and Owner information.
Источник