From 14b8e3299e0ea3c382776f92a45fc9ce7fae8e4c Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Fri, 29 Apr 2016 12:44:45 +0200 Subject: use MemAvailable as mem_free (exclude cached memory) --- sysinfo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysinfo.sh b/sysinfo.sh index 796922d..7fbb6f1 100755 --- a/sysinfo.sh +++ b/sysinfo.sh @@ -10,7 +10,7 @@ uptime=`uptime | sed -e 's/[ ][ ]*/ /g;s/ [0-9:]* up \(.*\), [0-9]* user.*/\1/'` #--- [ MEMORY ] ----------------------- mem_total=`cat /proc/meminfo | grep -i MemTotal | awk '{printf "%d",$2/1024;}'` -mem_free=`free | tail -n2 | head -n1 | sed 's/^.*://' | awk '{printf "%d",$2/1024;}'` +mem_free=`cat /proc/meminfo | grep -i MemAvailable | awk '{printf "%d",$2/1024;}'` mem_used=`echo ${mem_total} ${mem_free} | awk '{printf "%d",$1-$2;}'` swap_total=`cat /proc/meminfo | grep -i SwapTotal | awk '{printf "%d",$2/1024;}'` -- cgit v1.2.3