linux下查看内存条数及每根内存大小的实现方法(推荐)

在linux系统中,查看内存条个数,及每根内存的大小,可以使用dmidecode命令。

如下:

#dmidecode | grep -A16 "Memory Device$"

输出结果:

Memory Device #存储设备
Array Handle: 0x1000 #阵列处理
Error Information Handle: Not Provided #错误信息的处理:不提供 
Total Width: 72 bits #总宽度: 72位
Data Width: 64 bits #数据宽度: 64位 
Size: 1024 MB #大小
Form Factor: 
Set: 1
Locator: DIMM1 
Bank Locator: Not Specified
Type: 
Type Detail: Synchronous #输入详细信息:同步 
Speed: 667 MHz (1.5 ns) #速度: 667兆赫( 1.5纳秒)
Manufacturer: 80AD7FB380AD #制造商
Serial Number: 42600700 #序号
Asset Tag: 010910
Part Number: HYMP112F72CP8D3-Y5
--
//by www.nhooo.com
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: 
Set: 1
Locator: DIMM2 
Bank Locator: Not Specified
Type: 
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Manufacturer: 80AD7FB380AD
Serial Number: 42600213
Asset Tag: 010910
Part Number: HYMP112F72CP8D3-Y5
--
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: 
Set: 2
Locator: DIMM3 
Bank Locator: Not Specified
Type: 
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Manufacturer: 855185518551
Serial Number: 0503BE1A
Asset Tag: 4C0838
Part Number: 72T128401EFA3SC2 
--
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: 
Set: 2
Locator: DIMM4 
Bank Locator: Not Specified
Type: 
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Manufacturer: 855185518551
Serial Number: 0503BF1F
Asset Tag: 4C0838
Part Number: 72T128401EFA3SC2 
--
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: 
Set: 3
Locator: DIMM5 
Bank Locator: Not Specified
Type: 
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: 
Set: 3
Locator: DIMM6 
Bank Locator: Not Specified
Type: 
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: 
Set: 4
Locator: DIMM7 
Bank Locator: Not Specified
Type: 
Type Detail: Synchronous
Speed: Unknown
Manufacturer: 
Serial Number: 
Asset Tag: 
Part Number: 
--//by www.nhooo.com
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: 
Set: 4
Locator: DIMM8 
Bank Locator: Not Specified
Type: 
Type Detail: Synchronous
Speed: Unknown
Manufacturer: 
Serial Number: 
Asset Tag: 
Part Number:

然后,用free命令查看当前内存的使用情况:

# free -m 
total used free shared buffers cached
Mem: 4054 2963 1090 0 144 1272
-/+ buffers/cache: 1547 2506
Swap: 4094 0 4094

以上就是小编为大家带来的linux下查看内存条数及每根内存大小的实现方法(推荐)全部内容了,希望大家多多支持呐喊教程~