系统内置了dmidecode命令,

root@xxx:~# which dmidecode
/usr/sbin/dmidecode

root@xxx:~# 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
 -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
 -V, --version          Display the version and exit

通过-t指定TYPE就可以查询相关的信息,TYPE类型对应如下表所示:

Type   Information
 ────────────────────────────────────────────
    0   BIOS
    1   System
    2   Baseboard
    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 Devices Extended Information
   42   Management Controller Host Interface

一个查询结果实例,指定type=4可以看到Processor即CPU的相关信息,

root@xxx:~# dmidecode -t 4
# dmidecode 2.12
SMBIOS 2.5 present.

Handle 0x0004, DMI type 4, 40 bytes
Processor Information
        Socket Designation: CPU 1
        Type: Central Processor
        Family: Core 2 Duo
        Manufacturer: Intel
        ID: xx xx xx xx xx xx xx xx
        Signature: Type 0, Family 6, Model 23, Stepping 10
        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) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
        Voltage: 1.3 V
        External Clock: 333 MHz
        Max Speed: 3000 MHz
        Current Speed: 3000 MHz
        Status: Populated, Enabled
        Upgrade: Other
        L1 Cache Handle: 0x0005
        L2 Cache Handle: 0x0006
        L3 Cache Handle: 0x0007
        Serial Number: To Be Filled By O.E.M.
        Asset Tag: To Be Filled By O.E.M.
        Part Number: To Be Filled By O.E.M.
        Core Count: 2
        Core Enabled: 2
        Thread Count: 2
        Characteristics:
                64-bit capable