Memory Calculation Script!

Taking care of your Linux box.
Post Reply
refra
Naik
Posts: 70
Joined: Wed Dec 06, 2006 3:51 pm

Memory Calculation Script!

Post by refra »

AOA,

I need a script that calculate Free, Virtual Memory in percentage(%).
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

learn awk.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
mfaisalkh
Havaldaar
Posts: 124
Joined: Wed Mar 17, 2004 4:05 pm
Location: Karachi

Post by mfaisalkh »

AOA,

Try this:

SIZE=`free -m | grep Mem | cut -d " " -f11`
USED=`free -m | grep Mem | cut -d " " -f13-18`
PUSED=`echo 100 \* $USED / $SIZE | bc `

echo
echo "Total Physical Memory Physical Memory Used Memory Used (%)"
echo " $SIZE MB $USED MB $PUSED%"
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

he didn't ask for physical memory stats.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
nomankhn
Colonel
Posts: 714
Joined: Wed Aug 07, 2002 8:00 pm

Re: Memory Calculation Script!

Post by nomankhn »

refra wrote:AOA,

I need a script that calculate Free, Virtual Memory in percentage(%).

FYI

http://serverfault.com/questions/38065/ ... ith-vmstat

Thanks,
Noman
Post Reply