command to check RAM slots in motherboard?
You can use this command:
sudo lshw -class memory
It will give you an output like this:
*-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
Here in my system I have 4 memory slots in which currently I am using only one slot. In other slots you can see it shows empty
.
For maximum supportable memory use:
sudo dmidecode -t 16
or
sudo dmidecode -t memory
or
sudo dmidecode | grep -i "Maximum Capacity:" | uniq
EDIT: more interactive way to see Slot use small script (suggested by Serg)
sudo lshw -class memory | awk '/bank/ {count++} END {print "You have " count " slots for RAM"}'
Another way to get all the numbers directly;
To get the total number of slots:
sudo dmidecode -t memory | grep -c '^Memory Device$'
To get the number of slots used:
sudo dmidecode -t memory | grep -c -Po '^\tPart Number: (?!\[Empty\])'
To get the maximum capacity:
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