dmidecode 透過解讀 SMBIOS/DMI 表,以文字模式輸出系統硬體詳細資訊 (CPU、記憶體插槽、主機板、BIOS、機殼、埠口、插槽等),無需開機箱、無需重開機、可遠端 SSH 執行,是資產管理、硬體稽核、雲端主機規格確認的必備工具。
sudo apt-get install dmidecodesudo yum/dnf install dmidecodesudo pacman -S dmidecodesudo zypper install dmidecode不加參數執行 dmidecode 輸出所有記錄。每筆記錄包含 Record Header (Handle、DMI Type、Size) 與 Decoded Values (實際屬性值)。
| 關鍵字 | Type ID | 說明 |
|---|---|---|
bios | 0 | BIOS 資訊 |
system | 1 | 系統製造商、產品名稱、版本、序號、UUID |
baseboard | 2 | 主機板資訊 |
chassis | 3 | 機殼類型、製造商、序號 |
processor | 4 | CPU 插槽、型號、核心數、頻率、快取、旗標 |
memory | 5,6,16,17 | 記憶體控制器/模組/陣列/裝置 (建議直接用 memory 關鍵字) |
cache | 7 | CPU 快取 (L1/L2/L3) |
connector | 8 | 埠口連接器 |
slot | 9 | 系統插槽 (PCIe/PCI/AGP...) |
# 查看伺服器型號 (製造商 + 產品名稱)
dmidecode -t system | grep -E 'Manufacturer|Product Name'
# 查看主機板序號
dmidecode -t baseboard | grep 'Serial Number'
# 查看系統序號 (資產標籤)
dmidecode -s system-serial-number
# 查看記憶體詳細規格 (型號、速度、廠商、序號、容量)
dmidecode -t memory
# 查看 CPU 詳細資訊
dmidecode -t processor
# 查看 OEM 字串 (廠商自訂資訊)
dmidecode -t 11
# 僅顯示指定 DMI 字串 (不解碼完整記錄)
dmidecode -s bios-version
dmidecode -s baseboard-product-name
-q / --quiet:精簡輸出 (僅顯示 Decoded Values)。-u / --dump:輸出未解碼的原始十六進位記錄。--dump-bin FILE:將 DMI 資料寫入二進位檔;--from-dump FILE 讀取離線分析。-V / --version:顯示版本。0 BIOS 14 Group Associations
1 System 15 System Event Log
2 Base Board 16 Physical Memory Array
3 Chassis 17 Memory Device
4 Processor 18 32-bit Memory Error
5 Memory Controller 19 Memory Array Mapped Address
6 Memory Module 20 Memory Device Mapped Address
7 Cache 21 Built-in Pointing Device
8 Port Connector 22 Portable Battery
9 System Slots 23 System Reset
10 On Board Devices 24 Hardware Security
11 OEM Strings 25 System Power Controls
12 System Config Options 26 Voltage Probe
13 BIOS Language 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
/dev/mem 執行 dmidecode。