#!/bin/sh
#
# a script to simply display the accurate memory usage for the linux system.
# gnu-gpl feel free to copy edit or any any other change use or abuse this code,# so long as you don't try to claim ownership thereof to the exclusion of the
# rights of others to use, and do the same with it. thank you !
#
mem=(`cat /proc/meminfo | tr -d "[A-z] :" | tr "\n" " " | cut -d' ' -f-4`)
memused="$((( ${mem[0]} - ${mem[1]} - ${mem[2]} - ${mem[3]} ) / 1024))"
memtotal="$(( ${mem[0]} / 1024))"
memper="$((( $memused * 100 ) / $memtotal ))"
echo "Mem usage: $memused/$memtotal MB ($memper%)"