2015年4月14日 星期二

查詢 Linux 系統各個服務占用記憶體比例

Check the memory usage for all processes

#ps -eo pmem,pid,cmd | sort -k 1 -nr
It will display %MEM in first column, PID in second and Command in third for all running processes as below.
3.9 3094 /usr/sbin/mysqld
2.1 1779 iscsiuio
2.0 5371 /home/btest/TopCMM/
1.4 15386 /usr/bin/php
1.0 14465 /usr/local/apache/bin/httpd -DSSL
0.8 14515 /usr/local/apache/bin/httpd -DSSL
0.7 14514 /usr/local/apache/bin/httpd -DSSL
0.7 14511 /usr/local/apache/bin/httpd -DSSL
0.3 31925 lfd - sleeping
0.3 15377 /usr/sbin/exim -bd -q60m
0.2 9527 tailwatchd
0.2 5577 /usr/bin/python -tt /usr/sbin/yum-updatesd
0.2 2934 /usr/sbin/named -u named

Top 5 processes by memory usage.

To diplay top 5 processes by memory usage enter below command:
#ps -eo pmem,pid,cmd | sort -k 1 -nr | head -5
Output:
3.5 3094 /usr/sbin/mysqld
2.1 1779 iscsiuio
2.0 5371 /home/btest/TopCMM/
1.4 15386 /usr/bin/php
1.0 14465 /usr/local/apache/bin/httpd -DSSL

沒有留言:

張貼留言