If you are running out of RAM on your Linux system, you will want to find the culprit in order to solve the problem, either by reconfiguring the RAM-hungry application or by stopping it.
Method 1:
ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20
Example :
root@liuxforfrehers.com:~# ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20
1551 12.7 /opt/google/chrome/chrome
21268 11.1 /opt/google/chrome/chrome
2068 7.1 /opt/google/chrome/chrome
21416 6.4 /opt/google/chrome/chrome
28168 6.2 /opt/google/chrome/chrome
21564 5.8 /opt/google/chrome/chrome
26696 5.5 /opt/google/chrome/chrome
20802 5.2 /opt/google/chrome/chrome
14806 4.9 /opt/google/chrome/chrome
2223 4.8 /opt/google/chrome/chrome
4134 4.5 compiz
17267 3.7 /opt/google/chrome/chrome
21231 3.1 /opt/google/chrome/chrome
28135 2.4 /opt/google/chrome/chrome
21025 2.2 /opt/google/chrome/chrome
4369 2.0 /usr/lib/x86_64-linux-gnu/zeitgeist-fts
17330 1.5 /opt/google/chrome/chrome
21126 1.4 /opt/google/chrome/chrome
1324 1.1 /usr/lib/policykit-1/polkitd
3932 1.0 /usr/lib/x86_64-linux-gnu/hud/hud-service
Method 2:
Show the processes memory in megabytes and the process path.
ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -n
Method 3:
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
Example:
root@liuxforfrehers.com:~# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
PID PPID CMD %MEM %CPU
26696 20969 /opt/google/chrome/chrome - 21.6 1.8
1551 20969 /opt/google/chrome/chrome - 9.2 0.5
21268 20969 /opt/google/chrome/chrome - 9.0 1.4
2068 20969 /opt/google/chrome/chrome - 6.2 3.7
28168 20969 /opt/google/chrome/chrome - 5.0 1.1
20802 3680 /opt/google/chrome/chrome 4.8 3.9
21564 20969 /opt/google/chrome/chrome - 4.2 0.9
2223 20969 /opt/google/chrome/chrome - 4.0 5.1
4134 3938 compiz 3.8 2.3
Where pid is Process Id
Ppid is Parent Process Pid
%mem is Memory usage
%cpu is CPU usage
No comments:
Post a Comment