How do you determine the amount of system memory?
Shawn O'Shea
shawn at eth0.net
Wed Jul 30 12:55:49 EDT 2008
As Steve mentioned, dmidecode provides information on physical
> memory. Here's a quickie to dump memory sizes:
>
> sudo dmidecode -t 6 | grep Installed | grep -v Not | cut -f 2 -d :
> | cut -f 2,3 -d ' '
>
I was curious and gave this a run on my Dell Precision desktop here at work.
"-t 6" (type 6: Memory Module, see man dmidecode for all the types) returned
nothing on this Dell. Type 17 "Memory Device" shows all the slots in my
machine and reports their size. This alternate command line works for me
(sorry, I'm an awk geek so I had to use awk :)
dmidecode -t 17 | awk '/Size:/ { if ($2!="No") memtotal+=$2 } BEGIN {
memtotal=0 } END { print "Total memory: "memtotal" MB" }'
My system has 4 banks, two with 256MB chips and two empty (Size reports as
"No Module Installed"). (note, dmidecode must be in your path when you call
it with sudo like this. Alternatively you could call it as: sudo
/usr/sbin/dmidecode .....)
Sample runs:
[shawn at vecna ~]$ sudo dmidecode -t 17 | awk '/Size:/ { if ($2!="No")
memtotal+=$2 } BEGIN { memtotal=0 } END { print "Total memory: "memtotal"
MB" }'
Total memory: 512 MB
[shawn at mercury ~]$ sudo dmidecode -t 17 | awk '/Size:/ { if ($2!="No")
memtotal+=$2 } BEGIN { memtotal=0 } END { print "Total memory: "memtotal"
MB" }'
Total memory: 1024 MB
-Shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20080730/d60a479c/attachment.html
More information about the gnhlug-discuss
mailing list