Check TOP Memory and CPU use with ps command on Linux

Sunday, 22nd October 2017

linux-command-toolbox-how-to-check-maximum-cpu-load-and-max-memory-usage-with-ps-on-linux

There are plenty of software to check the GNU / Linux Server Load bottlenecks such as top / tload / slabtop / htop but for shell scripting purposes or perl  / python / ruby automation Dev Ops scripts and various Web and Middleware Tasks it is always better to know how to print list the TOP Memory and CPU consumption processes on Linux.

Below are two easy commands you can use to check out, which process is the most memory hungry and which running daemon (MySQL / PostgreSQL / Apache whatever) is the overloading your *nix server CPU.

TOP Memory use sorted by process memory max consumption

 

ps aux  | awk '{print $6/1024 " MBtt" $11}'  | sort -n

 


TOP CPU use sorted y running daemon
 

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10


Enjoy 🙂

Share this on:

Download PDFDownload PDF

Tags: , , , ,

Leave a Reply

CommentLuv badge