In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what is the command to get hardware details in Linux. It is very detailed and has a certain reference value. Friends who are interested must read it!
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
In the Linux system, especially in the server system, it is often necessary to check the hardware information of the device, so it is very convenient to use the command to view it. Commands to view hardware information in a Linux system, which are lspci, lsblk, lscpu, and lsusb.
Lspci command
You can also roughly see from the combination of the name ls+pci of the command that lspci is used to display information about the PCI bus in the system and the devices connected to it. By default, it displays a short list of devices, and if used with the specified options, it can display more detailed information.
Syntax format:
Lspci [parameters]
Common parameters:
Option description-n displays PCI vendor and device codes digitally-t displays hierarchical relationships of PCI devices in a tree structure-b bus-centric view-s displays only device and function block information for specified bus slots-I specifies PCI number list file, does not use the default file-m to display PCI device information in a machine-readable manner
Examples of use:
By default, this command is entered directly in the terminal to display all the PCI bus information of the current host:
Lspci
The output looks like this:
00v2/Xeon 00.0 Host bridge: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 DMI2 (rev 04)
00v2/Xeon 01.0 PCI bridge: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 1a (rev 04)
00v2/Xeon 02.0 PCI bridge: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2a (rev 04)
00v2/Xeon 02.2 PCI bridge: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2c (rev 04)
00v2/Xeon 03.0 PCI bridge: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3a (rev 04)
00v2/Xeon 05.0 System peripheral: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 VTd/Memory Map/Misc (rev 04)
00v2/Xeon 05.2 System peripheral: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 IIO RAS (rev 04)
00v2/Xeon 05.4 PIC: Intel Corporation Xeon E7 v2/Xeon E5 v2/Core i7 IOAPIC (rev 04)
.
Display the hierarchical relationship of PCI devices in a tree structure:
Lspci-t
Output:
-+-[0000:ff]-+-08.0
| | +-09.0 |
| | +-0a.0 |
| | +-0a.1 |
| | +-0a.2 |
| | +-0a.3 |
| | +-0b.0 |
| | +-0b.3 |
| | +-0c.0 |
| | +-0c.1 |
| | +-0c.2 |
| | +-0c.3 |
| | +-0d.0 |
| | +-0d.1 |
| | +-0d.2 |
| | +-0d.3 |
| | +-0e.0 |
| | +-0e.1 |
| | +-0f.0 |
| | +-0f.1 |
| | +-0f.2 |
| | +-0f.3 |
| | +-0f.4 |
| | +-0f.5 |
| | +-10.0 |
| | +-10.1 |
| | +-10.2 |
| | +-10.3 |
| | +-10.4 |
| | +-10.5 |
| | +-10.7 |
| | +-13.0 |
| | +-13.1 |
| | +-13.4 |
| | +-13.5 |
| | +-16.0 |
| | +-16.1 |
| |\-16.2 |
+-[0000VR 80]-+-00.0-[81]-
| | +-05.0 |
| | +-05.2 |
| |\-05.4 |
.
For more detailed information, you can use the following command:
Lspci-vvx
-vv: causes lspci to display more detailed information in over-redundant mode (in fact, everything that PCI devices can give). The exact meaning of these data is not explained in this man page. If you want to know more, please refer to the / usr/include/linux/pci.h or PCI specification.
-x: displays the first 64 bytes of the PCI configuration space (configuration space) in hexadecimal (standard header information). This parameter is useful for debugging drivers and lspci itself.
For more information about the parameter description in lspci, you can view it through man lspci in the terminal.
Lsblk command
Lsblk lists information about all or specified block devices, and lsblk lists information about all or specified block devices. By default, this command prints all devices (except RAM disks) in a tree format.
Syntax format:
Lsblk [parameters]
Examples of use:
By default, enter commands directly, similar to the following:
Lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Sda 8:0 0 1.1T 0 disk
├─ sda1 8:1 0 500M 0 part / boot
├─ sda2 8:2 0 31.3G 0 part [SWAP]
└─ sda3 8:3 0 1.1T 0 part /
Sr0 11:0 1 1024M 0 rom
NAME: this is the name of the block device.
MAJ:MIN: this column shows the primary and secondary device numbers.
RM: this column shows whether the device is removable. Note that in this example, the RM values of devices sdb and sr0 are equal to 1, indicating that they are removable devices.
SIZE: this column lists the capacity size information of the device. For example, 298.1g indicates that the size of the device is 298.1GB, while 1K indicates that the size of the device is 1KB.
RO: this item indicates whether the device is read-only. In this case, all devices have a Ro value of 0, indicating that they are not read-only.
TYPE: this column shows whether the block device is a disk or a partition on the disk. In this example, sda and sdb are disks, while sr0 is read-only storage (rom).
MOUNTPOINT: this column indicates the mount point of the device.
You can also list information for a specified device:
Lsblk / dev/sda
The output is similar to:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Sda 8:0 0 1.1T 0 disk
├─ sda1 8:1 0 500M 0 part / boot
├─ sda2 8:2 0 31.3G 0 part [SWAP]
└─ sda3 8:3 0 1.1T 0 part /
The lsblk command can also be used to list the ownership relationships of a particular device, as well as groups and patterns. You can obtain this information with the following command:
Lsblk-m
Output:
NAME SIZE OWNER GROUP MODE
Sda 1.1T root disk brw-rw
├─ sda1 500M root disk brw-rw
├─ sda2 31.3G root disk brw-rw
└─ sda3 1.1T root disk brw-rw
Sr0 1024M root cdrom brw-rw
More information can be viewed by entering man lsblk in the terminal.
Lscpu command
This command is used to display information about cpu. Lscpu collects cpu architecture information from sysfs and / proc/cpuinfo, and the output of the command is easy to read. The output of the lscpu command includes the number of cpu, threads, cores, sockets and Nom-Uniform Memeor Access (NUMA), cache, etc., not all columns support all schemas, and if unsupported columns are specified, lscpu prints the columns but does not display the data.
Syntax format:
Lscpu [parameters]
Common parameters:
Parameter description-a print online and offline CPU-b print only online CPU-c print only offline CPU-h print help and exit-V print the current version number
By default, commands are entered directly into the terminal:
Lscpu
The output is similar to the following:
Architecture: x86_64
CPU op-mode (s): 32-bit, 64-bit
Byte Order: Little Endian
CPU (s): 32
On-line CPU (s) list: 0-31
Thread (s) per core: 2
Core (s) per socket: 8
Socket (s): 2
NUMA node (s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 62
Model name: Intel (R) Xeon (R) CPU E5-2650 v2 @ 2.60GHz
Stepping: 4
CPU MHz: 1200.000
BogoMIPS: 5187.29
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 20480K
NUMA node0 CPU (s): 0-7J 16-23
NUMA node1 CPU (s): 8-15, 24-31
For more command details, you can enter the man lscpu command in the terminal to view it.
Lsusb command
The lsusb command is used to display a list of native USB devices, as well as details of USB devices. The USB device information displayed by the lsusb command comes from the corresponding file in the "/ proc/bus/usb" directory.
Syntax format:
Lsusb [parameters]
Common parameters:
Option description-v displays details of USB devices-s displays only devices with specified bus and / or device numbers-d displays only devices with specified manufacturer and product numbers-t displays the hierarchy of unreasonable USB devices in a tree structure-V displays version information of the command
Examples of use:
By default, enter commands directly in the terminal:
Lsusb
Display a list of USB devices:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 046b:ff10 American Megatrends, Inc. Virtual Keyboard and Mouse
Bus 002 Device 003: ID 0424:2513 Standard Microsystems Corp. 2.0 Hub
Display a list of USB devices in a tree:
Lsusb-t
Output:
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M
| | _ _ Port 1: Dev 2, If 0, Class=hub, Driver=hub/8p, 480m |
| | _ _ Port 5: Dev 3, If 0, Class=hub, Driver=hub/3p, 480m |
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M
| | _ _ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480m |
| | _ _ Port 6: Dev 3, If 0, Class=HID, Driver=usbhid, 12m |
| | _ _ Port 6: Dev 3, If 1, Class=HID, Driver=usbhid, 12m |
Display USB device details:
Lsusb-v
The output is similar to:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
BLength 18
BDescriptorType 1
BcdUSB 2.00
BDeviceClass 9 Hub
BDeviceSubClass 0 Unused
BDeviceProtocol 0 Full speed (or root) hub
BMaxPacketSize0 64
IdVendor 0x1d6b Linux Foundation
IdProduct 0x0002 2.0 root hub
BcdDevice 2.06
IManufacturer 3 Linux 2.6.32-642.el6.x86_64 ehci_hcd
IProduct 2 EHCI Host Controller
ISerial 1 0000:00:1a.0
BNumConfigurations 1
Configuration Descriptor:
BLength 9
BDescriptorType 2
WTotalLength 25
BNumInterfaces 1
BConfigurationValue 1
IConfiguration 0
BmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
BLength 9
BDescriptorType 4
BInterfaceNumber 0
BAlternateSetting 0
BNumEndpoints 1
BInterfaceClass 9 Hub
BInterfaceSubClass 0 Unused
BInterfaceProtocol 0 Full speed (or root) hub
IInterface 0
Endpoint Descriptor:
BLength 7
BDescriptorType 5
BEndpointAddress 0x81 EP 1 IN
BmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
WMaxPacketSize 0x0004 1x 4 bytes
BInterval 12
Hub Descriptor:
.
The above is all the contents of the article "what is the command to get hardware details in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.