With dmidecode we can get number of used and unused RAM slots details on mother board.
Following is the command (We have to run dmidecode command with sudo/root permission):
$ dmidecode -t 17 | grep "Size:"
Output:
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: 2048 MB
Size: 2048 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: 2048 MB
Size: 2048 MB
Above output shows that there are 4 used slots and 12 unused slots.
To get number of available RAM slots:
$ dmidecode -t 17 | grep -c "Size:"
or
$ dmidecode -t 17 | grep "Size:" | wc -l
Output:
16
-Sany