dmidecode

在Linux系統下獲取有關硬件方面的信息

補充說明

dmidecode命令 可以讓你在Linux系統下獲取有關硬件方面的信息。dmidecode的作用是將DMI數據庫中的信息解碼,以可讀的文本方式顯示。由於DMI信息可以人爲修改,因此裏面的信息不一定是系統準確的信息。dmidecode遵循SMBIOS/DMI標準,其輸出的信息包括BIOS、系統、主板、處理器、內存、緩存等等。

DMI(Desktop Management Interface,DMI)就是幫助收集電腦系統信息的管理系統,DMI信息的收集必須在嚴格遵照SMBIOS規範的前提下進行。SMBIOS(System Management BIOS)是主板或系統製造者以標準格式顯示產品管理信息所需遵循的統一規範。SMBIOS和DMI是由行業指導機構Desktop Management Task Force(DMTF)起草的開放性的技術標準,其中DMI設計適用於任何的平臺和操作系統。

DMI充當了管理工具和系統層之間接口的角色。它建立了標準的可管理系統更加方便了電腦廠商和用戶對系統的瞭解。DMI的主要組成部分是Management Information Format(MIF)數據庫。這個數據庫包括了所有有關電腦系統和配件的信息。通過DMI,用戶可以獲取序列號、電腦廠商、串口信息以及其它系統配件信息。

語法

1dmidecode [選項]

選項

1-d:(default:/dev/mem)從設備文件讀取信息,輸出內容與不加參數標準輸出相同。
2-h:顯示幫助信息。
3-s:只顯示指定DMI字符串的信息。(string)
4-t:只顯示指定條目的信息。(type)
5-u:顯示未解碼的原始條目內容。
6--dump-bin file:將DMI數據轉儲到一個二進制文件中。
7--from-dump FILE:從一個二進制文件讀取DMI數據。
8-V:顯示版本信息。

dmidecode參數string及type列表:

(1)Valid string keywords are:

  • bios-vendor
  • bios-version
  • bios-release-date
  • system-manufacturer
  • system-product-name
  • system-version
  • system-serial-number
  • system-uuid
  • baseboard-manufacturer
  • baseboard-product-name
  • baseboard-version
  • baseboard-serial-number
  • baseboard-asset-tag
  • chassis-manufacturer
  • chassis-type
  • chassis-version
  • chassis-serial-number
  • chassis-asset-tag
  • processor-family
  • processor-manufacturer
  • processor-version
  • processor-frequency

(2)Valid type keywords are:

  • bios
  • system
  • baseboard
  • chassis
  • processor
  • memory
  • Cache
  • connector
  • slot

(3)type全部編碼列表:

  • BIOS
  • System
  • Base Board
  • Chassis
  • Processor
  • Memory Controller
  • Memory Module
  • Cache
  • Port Connector
  • System Slots
  • On Board Devices
  • OEM Strings
  • System Configuration Options
  • BIOS Language
  • Group Associations
  • System Event Log
  • Physical Memory Array
  • Memory Device
  • 32-bit Memory Error
  • Memory Array Mapped Address
  • Memory Device Mapped Address
  • Built-in Pointing Device
  • Portable Battery
  • System Reset
  • Hardware Security
  • System Power Controls
  • Voltage Probe
  • Cooling Device
  • Temperature Probe
  • Electrical Current Probe
  • Out-of-band Remote Access
  • Boot Integrity Services
  • System Boot
  • 64-bit Memory Error
  • Management Device
  • Management Device Component
  • Management Device Threshold Data
  • Memory Channel
  • IPMI Device
  • Power Supply
  • Additional Information
  • Onboard Device

實例

 1dmidecode -t 1  # 查看服務器信息
 2dmidecode | grep 'Product Name' # 查看服務器型號 
 3dmidecode |grep 'Serial Number' # 查看主板的序列號 
 4dmidecode -t 2  # 查看主板信息
 5dmidecode -s system-serial-number # 查看系統序列號 
 6dmidecode -t memory # 查看內存信息 
 7dmidecode -t 11 # 查看OEM信息 
 8dmidecode -t 17 # 查看內存條數
 9dmidecode -t 16 # 查詢內存信息
10dmidecode -t 4  # 查看CPU信息
11
12cat /proc/scsi/scsi # 查看服務器硬盤信息

不帶選項執行dmidecode命令通常會輸出所有的硬件信息。dmidecode命令有個很有用的選項-t,可以按指定類型輸出相關信息,假如要獲得處理器方面的信息,則可以執行:

 1[root@localhost ~]# dmidecode -t processor
 2# dmidecode 2.11
 3SMBIOS 2.5 present.
 4
 5Handle 0x0001, DMI type 4, 40 bytes
 6Processor Information
 7        Socket Designation: Node 1 Socket 1
 8        Type: Central Processor
 9        Family: Xeon MP
10        Manufacturer: Intel(R) Corporation
11        id: C2 06 02 00 FF FB EB BF
12        Signature: Type 0, Family 6, Model 44, Stepping 2
13        Flags:
14                FPU (Floating-point unit on-chip)
15                VME (Virtual mode extension)
16                DE (Debugging extension)
17                PSE (Page size extension)
18                TSC (time stamp counter)
19                MSR (Model specific registers)
20                PAE (Physical address extension)
21                MCE (Machine check exception)
22                CX8 (CMPXCHG8 instruction supported)
23                APIC (On-chip APIC hardware supported)
24                SEP (Fast system call)
25                MTRR (Memory type range registers)
26                PGE (Page global enable)
27                MCA (Machine check architecture)
28                CMOV (Conditional move instruction supported)
29                PAT (Page attribute table)
30                PSE-36 (36-bit page size extension)
31                CLFSH (CLFLUSH instruction supported)
32                DS (Debug store)
33                ACPI (ACPI supported)
34                MMX (MMX technology supported)
35                FXSR (FXSAVE and FXSTOR instructions supported)
36                SSE (Streaming SIMD extensions)
37                SSE2 (Streaming SIMD extensions 2)
38                ss (Self-snoop)
39                HTT (Multi-threading)
40                TM (Thermal monitor supported)
41                PBE (Pending break enabled)
42        Version: Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz
43        Voltage: 1.2 V
44        External Clock: 5866 MHz
45        Max Speed: 4400 MHz
46        Current Speed: 2400 MHz
47        Status: Populated, Enabled
48        Upgrade: ZIF Socket
49        L1 Cache Handle: 0x0002
50        L2 Cache Handle: 0x0003
51        L3 Cache Handle: 0x0004
52        Serial Number: Not Specified
53        Asset Tag: Not Specified
54        Part Number: Not Specified
55        Core Count: 4
56        Core Enabled: 4
57        Thread Count: 8
58        Characteristics:
59                64-bit capable
60
61Handle 0x0055, DMI type 4, 40 bytes
62Processor Information
63        Socket Designation: Node 1 Socket 2
64        Type: Central Processor
65        Family: Xeon MP
66        Manufacturer: Not Specified
67        ID: 00 00 00 00 00 00 00 00
68        Signature: Type 0, Family 0, Model 0, Stepping 0
69        Flags: None
70        Version: Not Specified
71        Voltage: 1.2 V
72        External Clock: 5866 MHz
73        Max Speed: 4400 MHz
74        Current Speed: Unknown
75        Status: Unpopulated
76        Upgrade: ZIF Socket
77        L1 Cache Handle: Not Provided
78        L2 Cache Handle: Not Provided
79        L3 Cache Handle: Not Provided
80        Serial Number: Not Specified
81        Asset Tag: Not Specified
82        Part Number: Not Specified
83        Characteristics: None

查看內存的插槽數,已經使用多少插槽。每條內存多大,已使用內存多大

1dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range 
2
3#   Size: 2048 MB
4#   Size: 2048 MB
5#   Size: 4096 MB
6#   Size: No Module Installed

查看內存支持的最大內存容量

1dmidecode|grep -P 'Maximum\s+Capacity'
2
3#  Maximum Capacity: 16 GB

查看內存的頻率

 1dmidecode|grep -A16 "Memory Device"
 2
 3#   Memory Device
 4#     Array Handle: 0x1000
 5#     Error Information Handle: Not Provided
 6#     Total Width: 72 bits
 7#     Data Width: 64 bits
 8#     Size: 2048 MB
 9#     Form Factor: DIMM
10#     Set: 1
11#     Locator: DIMM_A1
12#     Bank Locator: Not Specified
13#     Type: DDR3
14#     Type Detail: Synchronous Unbuffered (Unregistered)
15#     Speed: 1333 MHz
16#     Manufacturer: 00CE000080CE
17#     Serial Number: 4830F3E1
18#     Asset Tag: 01093200
19#     Part Number: M391B5673EH1-CH9
20#   --
21#   Memory Device
22#     Array Handle: 0x1000
23#     Error Information Handle: Not Provided
24#     Total Width: 72 bits
25#     Data Width: 64 bits
26#     Size: 2048 MB
27#     Form Factor: DIMM
28#     Set: 1
29#     Locator: DIMM_A2
30#     Bank Locator: Not Specified
31#     Type: DDR3
32#     Type Detail: Synchronous Unbuffered (Unregistered)
33#     Speed: 1333 MHz
34#     Manufacturer: 00AD000080AD
35#     Serial Number: 1BA1F0B5
36#     Asset Tag: 01110900
37#     Part Number: HMT325U7BFR8C-H9
38#   --
39
40dmidecode|grep -A16 "Memory Device"|grep 'Speed'
41
42#  Speed: 1333 MHz
43#  Speed: 1333 MHz
44#  Speed: 1333 MHz
45#  Speed: Unknown
46
47```shell
48
49
50
51[來源](https://github.com/jaywcjlove/linux-command):https://github.com/jaywcjlove/linux-command
最後修改於: Wednesday, January 31, 2024

相關文章:

翻譯: