Linux 下查看内存条数的命令

发布时间:2020-05-25编辑:脚本学堂
本文介绍下,查看linux内存条数的命令,在linux下不用什么外部工具,直接用内置的命令即可查看内存条数等信息。有需要的朋友,参考下吧。

linux系统中,查看机器的硬件信息,可以用命令来实现。

比如下面查看内存的条数等信息的命令。

查看硬件信息,适用于ubuntu系列发行版本,命令:
lshw

Linux 下查看内存条数,命令:
 

复制代码 代码示例:
dmidecode |grep -A16 "Memory Device$"

比如我的这台centos主机,显示内容如下:
 

复制代码 代码示例:
[root@jbxue ~]# 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: 00AD000080AD
        Serial Number: 334485F9
        Asset Tag: 01113200
        Part Number: HMT325U7BFR8A-H9
--
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: 331485F6
        Asset Tag: 01113200
        Part Number: HMT325U7BFR8A-H9
--
Memory Device
        Array Handle: 0x1000
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 64 bits
        Size: No Module Installed
        Form Factor: DIMM
        Set: 2
        Locator: DIMM_A3
        Bank Locator: Not Specified
        Type: DDR3
        Type Detail: Synchronous
        Speed: Unknown
        Manufacturer:
        Serial Number:
        Asset Tag:
        Part Number:
--
Memory Device
        Array Handle: 0x1000
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 64 bits
        Size: No Module Installed
        Form Factor: DIMM
        Set: 2
        Locator: DIMM_A4
        Bank Locator: Not Specified
        Type: DDR3
        Type Detail: Synchronous
        Speed: Unknown
        Manufacturer:
        Serial Number:
        Asset Tag:
        Part Number:
--
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: 5
        Locator: DIMM_B1
        Bank Locator: Not Specified
        Type: DDR3
        Type Detail: Synchronous Unbuffered (Unregistered)
        Speed: 1333 MHz
        Manufacturer: 00AD000080AD
        Serial Number: 22BDC08E
        Asset Tag: 01113000
        Part Number: HMT325U7BFR8A-H9
--
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: 6
        Locator: DIMM_B2
        Bank Locator: Not Specified
        Type: DDR3
        Type Detail: Synchronous Unbuffered (Unregistered)
        Speed: 1333 MHz
        Manufacturer: 00AD000080AD
        Serial Number: 33C48622
        Asset Tag: 01113200
        Part Number: HMT325U7BFR8A-H9
--
Memory Device
        Array Handle: 0x1000
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 64 bits
        Size: No Module Installed
        Form Factor: DIMM
        Set: 6
        Locator: DIMM_B3
        Bank Locator: Not Specified
        Type: DDR3
        Type Detail: Synchronous
        Speed: Unknown
        Manufacturer:
        Serial Number:
        Asset Tag:
        Part Number:
--
Memory Device
        Array Handle: 0x1000
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 64 bits
        Size: No Module Installed
        Form Factor: DIMM
        Set: 4
        Locator: DIMM_B4
        Bank Locator: Not Specified
        Type: DDR3
        Type Detail: Synchronous
        Speed: Unknown
        Manufacturer:
        Serial Number:
        Asset Tag:
        Part Number:
[root@jbxue ~]#

另外,有关dmidecode命令的详细用法,可以参考文章:
Linux 下dmidecode查看内存条数的命令
linux查看主板内存槽与内存信息的命令dmidecode
dmidecode命令解读服务器硬件信息