Monday, 16 June 2014

How To Find Top 10 CPU & Memory Consuming Processes

In this post I will try to explain how to find out the top 10 processes that are most consuming the CPU and Memory Resources on the System.

To achieve this we will use the ps command.

To view all running processes on the system we use
[root@server ~]# ps -aux

To view custom columns we use the below command
[root@server ~]# ps axo stat,euser,ruser,%mem,pid,%cpu,comm

Here 
stat -> status of the process
euser -> effective user
ruser -> real user
%mem -> percentage of memory utilized by process
pid -> process ID
%cpu -> percentage of memory utilized by process
comm -> command

To view top 10 memory utilized process process
 [root@server ~]# ps axo ruser,%mem,comm,pid,euser | sort -nr | head -n 10
 RUSER    %MEM COMMAND           PID EUSER
root      0.4 sshd             3189 root
root      0.4 sshd             2486 root
root      0.2 master           1194 root
root      0.1 rsyslogd         2918 root
root      0.1 ps               3355 root
root      0.1 login            1217 root
root      0.1 bash             3191 root
root      0.1 bash             3080 root
root      0.1 bash             2488 root

To view top 10 memory utilized process process
[root@server ~]# ps axo ruser,%cpu,comm,pid,euser | sort -nr | head -n 10
RUSER    %CPU COMMAND           PID EUSER
root      0.2 events/0            7 root
root      0.0 watchdog/0          6 root
root      0.0 vsftpd           1118 root
root      0.0 vmmemctl          593 root
root      0.0 usbhid_resumer     41 root
root      0.0 udevd             420 root
root      0.0 udevd            1235 root
root      0.0 udevd            1234 root
root      0.0 sync_supers        13 root

No comments:

Post a Comment