命令检查主板上的RAM插槽?

我有三星NP300e5Z i5笔记本电脑。 我在这台笔记本电脑中使用Ubuntu 14.04。 我的系统内存是4GB ,我想增加它,但我不知道我的系统有多少内存插槽可用。 那么,如何检查

  • 有多少内存插槽?
  • 我的系统当前使用了多少个插槽?
  • 什么是我可以增加的最大RAM大小?

任何建议将不胜感激

使用命令

 sudo lshw -class memory 

它会给你像:

  *-memory description: System Memory physical id: 33 slot: System board or motherboard size: 4GiB *-bank:0 description: DIMM [empty] physical id: 0 slot: ChannelA-DIMM0 *-bank:1 description: DIMM [empty] physical id: 1 slot: ChannelA-DIMM1 *-bank:2 description: SODIMM DDR3 Synchronous 1333 MHz (0.8 ns) product: AD73I1C1674EV vendor: Fujitsu physical id: 2 serial: 43D30100 slot: ChannelB-DIMM0 size: 2GiB width: 64 bits clock: 1333MHz (0.8ns) *-bank:3 description: DIMM [empty] physical id: 3 slot: ChannelB-DIMM1 

在我的系统中,我有4个内存插槽,目前我只使用一个插槽。 其他你可以看到它显示为empty

最大可支持内存使用命令:

 sudo dmidecode -t 16 

要么

 sudo dmidecode -t memory 

要么

  sudo dmidecode |grep -i "Maximum Capacity:" | uniq 

编辑:更多的互动方式看Slot使用小脚本(由Serg建议)

 sudo lshw -class memory | awk '/bank/ {count++} END {print "You have " count "slots for RAM"}' 

另一种直接获取所有数字的方法;

要获得插槽总数:

 sudo dmidecode -t memory | grep -c '^Memory Device$' 

要获得使用的插槽数量:

 sudo dmidecode -t memory | grep -c -Po '^\tPart Number: (?!\[Empty\])' 

要获得最大容量:

 sudo dmidecode -t memory | grep -Po '^\tMaximum Capacity: \K.*' 
 ubuntu@ubuntu ~ % sudo dmidecode -t memory | grep -c '^Memory Device$' 4 ubuntu@ubuntu ~ % sudo dmidecode -t memory | grep -c -Po '^\tPart Number: (?!\[Empty\])' 1 ubuntu@ubuntu ~ % sudo dmidecode -t memory | grep -Po '^\tMaximum Capacity: \K.*' 32 GB