#!/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 "\n" "#" | tr -d "[A-z] :"`" memused="$(((`echo "$mem" | cut -d'#' -f1` - `echo "$mem" |\ cut -d'#' -f2` - `echo "$mem" | cut -d'#' -f3` - `echo "$mem" |\ cut -d'#' -f4`) / 1024))" memtotal="$((`echo "$mem" | cut -d'#' -f1` / 1024))" memper="$((($memused * 100) / $memtotal))" echo "Mem usage: $memused/$memtotal MB ($memper%)"