Linux List Free Memory Pretty Output

Who doesn’t like pretty command output?

resize; echo -ne '\n';echo "===========================================";ps -eo user,%cpu,%mem,rsz,args|sort -rnk4|awk 'BEGIN {printf "%s\t%s\t%s\t%s\t%s\n","USER","%CPU","%MEM","RSZ","COMMAND"}{printf "%s\t%g'%'\t%g'%'\t%d MB\t%-10s\n",$1,$2,$3,$4/1024,$5}'|head -n30;echo "===========================================";echo -e "\n===========================================";vmstat -s -S M|head -n10;echo "===========================================";

Sample output:

Or to see output with pid

resize; echo -ne '\n';echo "===========================================";ps -eo user,pid,%cpu,%mem,rsz,args|sort -rnk4|awk 'BEGIN {printf "%s\t\t%s\t\t%s\t%s\t%s\t%s\n","USER","PID","%CPU","%MEM","RSZ","COMMAND"}{printf "%s\t\t\%s\t\t%g'%'\t%g'%'\t%d MB\t%-10s\n",$1,$2,$3,$4,$5/1024,$6}'|head -n30;echo "===========================================";echo -e "\n===========================================";vmstat -s -S M|head -n10;echo "==========================================="

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.