查看服务器内存信息
dmidecode|grep -P -A5 "Memory\s+Device"|grep Size
[[email protected] home]# dmidecode|grep -P -A5 "Memory\s+Device"|grep Size
Size: 16384 MB
Size: No Module Installed
Size: No Module Installed
Size: 16384 MB
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: 16384 MB
Size: No Module Installed
Size: No Module Installed
Size: 16384 MB
查看共有多少个槽位
[[email protected] home]# dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|wc -l
24
查看共插了多少根内存条
[[email protected] ~]# dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|awk -F: ‘BEGIN{count=0}$2~/16384 MB/{count++}END{print "count="count}‘
count=32