RAM Meter

Posted in System by matt 3181 days ago

Inspired by the CPU meter posted by blair1618, Vanglad posted the code for this RAM Meter in the comments. The code didn't display very well, so here's a downloadable .glet file that you can use instead.

myRAM=`top -l 1 -F -R | awk '/PhysMem/ {print "" $8+0}'`
myPercentRAM=`expr $myRAM \* 100 / $totalRAM`
declare -i a=5 
while [ $a -lt $myPercentRAM ] 
    echo "|\c"
    a=`expr $a + 5`
echo "\033[1;31m|\033[0m\c"
while [ $a -lt 100 ] 
    echo "\033[1;30m|\033[0m\c" 
    a=`expr $a + 5`
echo "\n"
unset myRAM
unset myPercentRAM
unset a

Geeklet files to download


User Avatar
chuckles911 3145 days ago
Hey, well, when i download this and run it i only get a bar of white lines?  i cant get it to display anything, and i know my RAM isnt like, freaking out so... Help?
User Avatar
Stelkeeg 3130 days ago
It's freaking out because it's reading your computer only has 2048 mb of RAM, and since your probably running over that amount it prints the gauge as full.  Fortunately there is a quick fix.  You have to edit the second line of the script, where it says:


CHANGE ONLY THE NUMBER.  The number is the total amount of RAM you have in YOUR computer in megabytes.  So if you have 4GB you would put 4000.  This should make the meter read properly. 


Log in to comment or register here.