This shell script explains how to find out your system RAM memory usage by  percentage level, free memory. How much your RAM memory Linux ate exactly and free.

To check ram memory space.

#  free -m

             total       used       free     shared    buffers     cached
Mem:          5799       5420        378         10        555       3596
-/+ buffers/cache:       1268       4530
Swap:         8191        553       7638
#TOTAL RAM  in MB : 5799

#FREE  RAM  in MB : 4530

#RAM   USED in %  : 22%

Shell Script:


#!/bin/bash
#Total RAM USAGE
TOTAL_RAM=`free -m | awk '{print $2}'| head -2 | tail -1`
echo $TOTAL_RAM

#FRE RAM USAGE
FREE_RAM=`free -m | awk '{print $4}'| head -3| tail -1`
echo $FREE_RAM

#expr $FREE_RAM - $TOTAL_RAM
FREE_PERCENT=$(( 100*FREE_RAM / TOTAL_RAM ))
USED_PERCENT=$(( 100-$FREE_PERCENT))
echo "Percentage Used :" $USED_PERCENT

Reference: http://www.linuxatemyram.com/