Hi i just wanted to know what is the code to display amount of RAM and also the percentage used? I know i can possibly use the vmstat code but what part indicates the RAM? Any help would be much appreciated. Thanks
On Linux:
$ free -o | awk 'BEGIN{ OFS="\t"; print "", "Total", "Used", "Free", "% used", "% free" }
/^[^ ]/{ print $1, $2, $3, $4, $3/$2*100, $4/$2*100 }'
Mem: 512344 83580 428764 16.3133 83.6867
Swap: 1919756 0 1919756 0 100
Might work on others too, I'm not sure on the -o switch (without it, free also displays info about buffers)