linux查看内存,CPU,服务器品牌的方法分享

发布时间:2021-01-18编辑:脚本学堂
本文介绍下,在linux系统中,查看内存、CPU及服务器品牌的方法,有需要的朋友参考下吧。

命令:
 

复制代码 代码示例:
# cat  /proc/cpuinfo //查看cpu个数与频率
# dmidecode  |grep  "Product Name"  //查看服务器品牌和型号

查看主板几个内存插槽、最高支持多大内存、现已使用几个插槽。
命令:
 

复制代码 代码示例:

# dmidecode|grep -P 'Maximums+Capacity'    //最大支持几G内存

# dmidecode|grep -P -A5 "Memorys+Device"|grep Size|grep -v Range       //总共几个插槽,已使用几个插槽
Size: 1024 MB       //此插槽有1根1G内存
Size: 1024 MB       //此插槽有1根1G内存
Size: 1024 MB       //此插槽有1根1G内存
Size: 1024 MB       //此插槽有1根1G内存
Size: No Module Installed       //此插槽未使用
Size: No Module Installed       //此插槽未使用

方法2,查看内存总插槽数、已插几条内存、内存多大、内存频率多少?
 

复制代码 代码示例:
# dmidecode -t 17        //数字17是dmidecode的参数,本文最后有其他数字参数
dmidecode 2.7
SMBIOS 2.4 present.
Handle 0x0015, DMI type 17, 27 bytes.
Memory Device
  Array Handle: 0x0013
  Error Information Handle: Not Provided
  Total Width: 72 bits
  Data Width: 64 bits
  Size: 2048 MB 【插槽1有1条2GB内存】
  Form Factor: DIMM
  Set: None
  Locator: DIMM00
  Bank Locator: BANK
  Type: Other
  Type Detail: Other
  Speed: 667 MHz (1.5 ns)
  Manufacturer:
  Serial Number: BZACSKZ001
  Asset Tag: RAM82
  Part Number: MT9HTF6472FY-53EA2
Handle 0x0017, DMI type 17, 27 bytes.
Memory Device
  Array Handle: 0x0013
  Error Information Handle: Not Provided
  Total Width: 72 bits
  Data Width: 64 bits
  Size: 2048 MB 【插槽2有1条2GB内存】
  Form Factor: DIMM
  Set: None
  Locator: DIMM10
  Bank Locator: BANK
  Type: Other
  Type Detail: Other
  Speed: 667 MHz (1.5 ns)
  Manufacturer:
  Serial Number: BZACSKZ001
  Asset Tag: RAM83
  Part Number: MT9HTF6472FY-53EA2
Handle 0x0019, DMI type 17, 27 bytes.
Memory Device
  Array Handle: 0x0013
  Error Information Handle: Not Provided
  Total Width: 72 bits
  Data Width: 64 bits
  Size: 2048 MB 【插槽3有1条2GB内存】
  Form Factor: DIMM
  Set: None
  Locator: DIMM20
  Bank Locator: BANK
  Type: Other
  Type Detail: Other
  Speed: 667 MHz (1.5 ns)
  Manufacturer:
  Serial Number: BZACSKZ001
  Asset Tag: RAM84
  Part Number: MT9HTF6472FY-53EA2
Handle 0x001B, DMI type 17, 27 bytes.
Memory Device
  Array Handle: 0x0013
  Error Information Handle: Not Provided
  Total Width: 72 bits
  Data Width: 64 bits
  Size: 2048 MB 【插槽4有1条2GB内存】
  Form Factor: DIMM
  Set: None
  Locator: DIMM30
  Bank Locator: BANK
  Type: Other
  Type Detail: Other
  Speed: 667 MHz (1.5 ns)
  Manufacturer:
  Serial Number: BZACSKZ001
  Asset Tag: RAM85
  Part Number: MT9HTF6472FY-53EA2

根据上面输出可以发现,主板共4个内存插槽,每个插槽多少内存,所用内存频率多大。

附录:
dmidecode支持的数字参数:
 

Type   Information
   ----------------------------------------
        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