Linux命令 dmidecode - 在Linux系統(tǒng)下獲取有關(guān)硬件方面的信息

2021-11-08 15:15 更新

dmidecode

在Linux系統(tǒng)下獲取有關(guān)硬件方面的信息

補(bǔ)充說(shuō)明

dmidecode命令 可以讓你在Linux系統(tǒng)下獲取有關(guān)硬件方面的信息。dmidecode的作用是將DMI數(shù)據(jù)庫(kù)中的信息解碼,以可讀的文本方式顯示。由于DMI信息可以人為修改,因此里面的信息不一定是系統(tǒng)準(zhǔn)確的信息。dmidecode遵循SMBIOS/DMI標(biāo)準(zhǔn),其輸出的信息包括BIOS、系統(tǒng)、主板、處理器、內(nèi)存、緩存等等。

DMI(Desktop Management Interface,DMI)就是幫助收集電腦系統(tǒng)信息的管理系統(tǒng),DMI信息的收集必須在嚴(yán)格遵照SMBIOS規(guī)范的前提下進(jìn)行。SMBIOS(System Management BIOS)是主板或系統(tǒng)制造者以標(biāo)準(zhǔn)格式顯示產(chǎn)品管理信息所需遵循的統(tǒng)一規(guī)范。SMBIOS和DMI是由行業(yè)指導(dǎo)機(jī)構(gòu)Desktop Management Task Force(DMTF)起草的開(kāi)放性的技術(shù)標(biāo)準(zhǔn),其中DMI設(shè)計(jì)適用于任何的平臺(tái)和操作系統(tǒng)。

DMI充當(dāng)了管理工具和系統(tǒng)層之間接口的角色。它建立了標(biāo)準(zhǔn)的可管理系統(tǒng)更加方便了電腦廠商和用戶對(duì)系統(tǒng)的了解。DMI的主要組成部分是Management Information Format(MIF)數(shù)據(jù)庫(kù)。這個(gè)數(shù)據(jù)庫(kù)包括了所有有關(guān)電腦系統(tǒng)和配件的信息。通過(guò)DMI,用戶可以獲取序列號(hào)、電腦廠商、串口信息以及其它系統(tǒng)配件信息。

語(yǔ)法

dmidecode [選項(xiàng)]

選項(xiàng)

-d:(default:/dev/mem)從設(shè)備文件讀取信息,輸出內(nèi)容與不加參數(shù)標(biāo)準(zhǔn)輸出相同。
-h:顯示幫助信息。
-s:只顯示指定DMI字符串的信息。(string)
-t:只顯示指定條目的信息。(type)
-u:顯示未解碼的原始條目?jī)?nèi)容。
--dump-bin file:將DMI數(shù)據(jù)轉(zhuǎn)儲(chǔ)到一個(gè)二進(jìn)制文件中。
--from-dump FILE:從一個(gè)二進(jìn)制文件讀取DMI數(shù)據(jù)。
-V:顯示版本信息。

dmidecode參數(shù)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

實(shí)例

dmidecode -t 1  # 查看服務(wù)器信息
dmidecode | grep 'Product Name' # 查看服務(wù)器型號(hào) 
dmidecode |grep 'Serial Number' # 查看主板的序列號(hào) 
dmidecode -t 2  # 查看主板信息
dmidecode -s system-serial-number # 查看系統(tǒng)序列號(hào) 
dmidecode -t memory # 查看內(nèi)存信息 
dmidecode -t 11 # 查看OEM信息 
dmidecode -t 17 # 查看內(nèi)存條數(shù)
dmidecode -t 16 # 查詢內(nèi)存信息
dmidecode -t 4  # 查看CPU信息

cat /proc/scsi/scsi # 查看服務(wù)器硬盤(pán)信息

不帶選項(xiàng)執(zhí)行dmidecode命令通常會(huì)輸出所有的硬件信息。dmidecode命令有個(gè)很有用的選項(xiàng)-t,可以按指定類型輸出相關(guān)信息,假如要獲得處理器方面的信息,則可以執(zhí)行:

[root@localhost ~]# dmidecode -t processor
# dmidecode 2.11
SMBIOS 2.5 present.

Handle 0x0001, DMI type 4, 40 bytes
Processor Information
        Socket Designation: Node 1 Socket 1
        Type: Central Processor
        Family: Xeon MP
        Manufacturer: Intel(R) Corporation
        id: C2 06 02 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 44, Stepping 2
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (FXSAVE and FXSTOR instructions supported)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                ss (Self-snoop)
                HTT (Multi-threading)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz
        Voltage: 1.2 V
        External Clock: 5866 MHz
        Max Speed: 4400 MHz
        Current Speed: 2400 MHz
        Status: Populated, Enabled
        Upgrade: ZIF Socket
        L1 Cache Handle: 0x0002
        L2 Cache Handle: 0x0003
        L3 Cache Handle: 0x0004
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Core Count: 4
        Core Enabled: 4
        Thread Count: 8
        Characteristics:
                64-bit capable

Handle 0x0055, DMI type 4, 40 bytes
Processor Information
        Socket Designation: Node 1 Socket 2
        Type: Central Processor
        Family: Xeon MP
        Manufacturer: Not Specified
        ID: 00 00 00 00 00 00 00 00
        Signature: Type 0, Family 0, Model 0, Stepping 0
        Flags: None
        Version: Not Specified
        Voltage: 1.2 V
        External Clock: 5866 MHz
        Max Speed: 4400 MHz
        Current Speed: Unknown
        Status: Unpopulated
        Upgrade: ZIF Socket
        L1 Cache Handle: Not Provided
        L2 Cache Handle: Not Provided
        L3 Cache Handle: Not Provided
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Characteristics: None

查看內(nèi)存的插槽數(shù),已經(jīng)使用多少插槽。每條內(nèi)存多大,已使用內(nèi)存多大

dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range 

#   Size: 2048 MB
#   Size: 2048 MB
#   Size: 4096 MB
#   Size: No Module Installed

查看內(nèi)存支持的最大內(nèi)存容量

dmidecode|grep -P 'Maximum\s+Capacity'

#  Maximum Capacity: 16 GB

查看內(nèi)存的頻率

dmidecode|grep -A16 "Memory Device"

#   Memory Device
#     Array Handle: 0x1000
#     Error Information Handle: Not Provided
#     Total Width: 72 bits
#     Data Width: 64 bits
#     Size: 2048 MB
#     Form Factor: DIMM
#     Set: 1
#     Locator: DIMM_A1
#     Bank Locator: Not Specified
#     Type: DDR3
#     Type Detail: Synchronous Unbuffered (Unregistered)
#     Speed: 1333 MHz
#     Manufacturer: 00CE000080CE
#     Serial Number: 4830F3E1
#     Asset Tag: 01093200
#     Part Number: M391B5673EH1-CH9
#   --
#   Memory Device
#     Array Handle: 0x1000
#     Error Information Handle: Not Provided
#     Total Width: 72 bits
#     Data Width: 64 bits
#     Size: 2048 MB
#     Form Factor: DIMM
#     Set: 1
#     Locator: DIMM_A2
#     Bank Locator: Not Specified
#     Type: DDR3
#     Type Detail: Synchronous Unbuffered (Unregistered)
#     Speed: 1333 MHz
#     Manufacturer: 00AD000080AD
#     Serial Number: 1BA1F0B5
#     Asset Tag: 01110900
#     Part Number: HMT325U7BFR8C-H9
#   --

dmidecode|grep -A16 "Memory Device"|grep 'Speed'

#  Speed: 1333 MHz
#  Speed: 1333 MHz
#  Speed: 1333 MHz
#  Speed: Unknown

```shell




以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)