查看服務器硬件信息
dmidecode
root@uos-PC:/home/uos/Downloads/log/var/log/tuned# dmidecode -h
Usage: dmidecode [OPTIONS]
Options are:
-d, --dev-mem FILE Read memory from device FILE (default: /dev/mem)
-h, --help Display this help text and exit
-q, --quiet Less verbose output
-s, --string KEYWORD Only display the value of the given DMI string
-t, --type TYPE Only display the entries of given type
-H, --handle HANDLE Only display the entry of given handle
-u, --dump Do not decode the entries
–dump-bin FILE Dump the DMI data to a binary file
–from-dump FILE Read the DMI data from a binary file
–no-sysfs Do not attempt to read DMI data from sysfs files
–oem-string N Only display the value of the given OEM string
-V, --version Display the version and exit
例如查看電源信息
$ dmidecode > /tmp/hardware.log
$ grep -ni "system power" /tmp/hardware.log
551:System Power Supply
## 可以進入/tmp/hardware.log 查看具體內(nèi)容
System Power Supply
Power Unit Group: 1
Location: To Be Filled By O.E.M.
Name: To Be Filled By O.E.M.
Manufacturer: To Be Filled By O.E.M.
Serial Number: To Be Filled By O.E.M.
Asset Tag: To Be Filled By O.E.M.
Model Part Number: To Be Filled By O.E.M.
Revision: To Be Filled By O.E.M.
Max Power Capacity: Unknown
Status: Present, OK
Type: Switching
Input Voltage Range Switching: Auto-switch
Plugged: Yes
Hot Replaceable: No
Input Voltage Probe Handle: 0x0035
Cooling Device Handle: 0x0037
Input Current Probe Handle: 0x0038
如果電源是雙電源,則會顯示兩組一樣的信息
#有效輸入關(guān)鍵詞:
bios
system
baseboard
chassis
processor
memory
Cache
connector
slot
全部編碼列表
#全部編碼列表
0 BIOS
1 System
2 Base Board
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply
40 Additional Information
41 Onboard Device
可以通過命令
dmidecode -t 編碼
來獲取指定的硬件信息
例如獲取電源信息文章來源:http://www.zghlxwxcb.cn/news/detail-413219.html
$ /usr/sbin/dmidecode -t 39
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.
Handle 0x0039, DMI type 39, 22 bytes
System Power Supply
Power Unit Group: 1
Location: To Be Filled By O.E.M.
Name: To Be Filled By O.E.M.
Manufacturer: To Be Filled By O.E.M.
Serial Number: To Be Filled By O.E.M.
Asset Tag: To Be Filled By O.E.M.
Model Part Number: To Be Filled By O.E.M.
Revision: To Be Filled By O.E.M.
Max Power Capacity: Unknown
Status: Present, OK
Type: Switching
Input Voltage Range Switching: Auto-switch
Plugged: Yes
Hot Replaceable: No
Input Voltage Probe Handle: 0x0035
Cooling Device Handle: 0x0037
Input Current Probe Handle: 0x0038
使用lshw
# lshw --help
Hardware Lister (lshw) -
usage: lshw [-format] [-options ...]
lshw -version
-version print program version ()
format can be
-html output hardware tree as HTML
-xml output hardware tree as XML
-json output hardware tree as a JSON object
-short output hardware paths
-businfo output bus information
options can be
-class CLASS only show a certain class of hardware
-C CLASS same as '-class CLASS'
-c CLASS same as '-class CLASS'
-disable TEST disable a test (like pci, isapnp, cpuid, etc. )
-enable TEST enable a test (like pci, isapnp, cpuid, etc. )
-quiet don't display status
-sanitize sanitize output (remove sensitive information like serial numbers, etc.)
-numeric output numeric IDs (for PCI, USB, etc.)
-notime exclude volatile attributes (timestamps) from output
lshw > hardware.txt
會記錄所有硬件的相關(guān)信息
但可以使用其他命令查看
例如內(nèi)存相關(guān)可以使用lsmem
和lshw中的顯示內(nèi)存部分是相同的
cpu可以使用lscpu
查看文章來源地址http://www.zghlxwxcb.cn/news/detail-413219.html
到了這里,關(guān)于【Linux】查看服務器硬件信息的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!