<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">cat /proc/meminfo | awk '/MemTotal:/ {<br>                m = $2<br>                f = m /= 1024 # Mb<br>                f /= 1024 # Gb<br>         }<br>         END {printf "%0.f\n", f }'<br><br>on my machine I get 16 = 16 Gb<br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Patrick Lists
 <ks-list@puzzled.xs4all.nl><br><b><span style="font-weight: bold;">To:</span></b> jamesaharrisonuk@yahoo.co.uk; Discussion list about Kickstart <kickstart-list@redhat.com><br><b><span style="font-weight: bold;">Sent:</span></b> Tue, December 21, 2010 8:10:07 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: Detecting amount of memory?<br></font><br>
On 12/21/2010 01:39 PM, <a ymailto="mailto:jamesaharrisonuk@yahoo.co.uk" href="mailto:jamesaharrisonuk@yahoo.co.uk">jamesaharrisonuk@yahoo.co.uk</a> wrote:<br>> The kernel reports the amount of memory in /proc/meninfo .  It shows the memory information in kilobytes.<br>> James<br>> Sent from my Verizon Wireless BlackBerry<br><br>Thank you for your suggestion James. I tried it out and /proc/meminfo<br>seems to give the same amount of memory as free:<br><br>$ grep "MemTotal" /proc/meminfo | awk '{ print $2 }'<br>6123716<br><br>Fortunately I did find some awk voodoo that works. For the archives here<br>it is. Mind the line breaks. Line 2,3,4 should be all one line.<br><br>mem=$(free|grep Mem|awk '{print$2}')<br>echo "$mem" | awk '{ n = $0; sub(/[0-9]+(.[0-9]+)?/, ""); split(n, a,<br>$0); n=a[1]; if ($0 == "G" || $0 == "") { n *= 1024 }; if (/^kB?/) { n<br>/= 1024 }; printf "%d\n", n }'<br># Intentionaly round to an integer<br><br>This line
 gives 6144 on a box with 6GB mem.<br><br>Regards,<br>Patrick<br><br>[snip]<br></div></div>
</div><br>







      </body></html>