Find Out Top 10 Memory and CPU Consuming Processes in linux
for memory:
ps auxf | sort -nr -k 4 | head
sample output:
[root@amitmaheshwari.in ~] # ps auxf | sort -nr -k 4 | head
daemon 10566 2.5 4.2 238580 169756 ? S 14:22 1:23 Rails: /opt/redmine-2.1.2-1/apache2/htdocs/../../apps/redmine/htdocs
mysql 24711 0.0 1.6 340088 64756 ? Sl 2013 160:39 \_ /opt/redmine-2.1.2-1/mysql/bin/mysqld.bin --defaults-file=/opt/redmine-2.1.2-1/mysql/my.cnf --basedir=/opt/redmine-2.1.2-1/mysql --datadir=/opt/redmine-2.1.2-1/mysql/data --plugin-dir=/opt/redmine-2.1.2-1/mysql/lib/plugin --user=mysql --lower-case-table-names=1 --log-error=/opt/redmine-2.1.2-1/mysql/data/mysqld.log --pid-file=/opt/redmine-2.1.2-1/mysql/data/nhst-empd.com.pid --socket=/opt/redmine-2.1.2-1/mysql/tmp/mysql.sock --port=3306
root 24792 0.0 0.3 38228 12936 ? Sl 2013 47:40 | | \_ Passenger spawn server
xfs 23299 0.0 0.0 10288 400 ? Ss 2013 0:02 xfs -droppriv -daemon
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9 0.0 0.0 0 0 ? S< 2013 0:00 [kthread]
root 8 0.0 0.0 0 0 ? S< 2013 0:00 [khelper]
root 7 0.0 0.0 0 0 ? S< 2013 124:04 [events/1]
root 67 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/1]
root 66 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/0]
for cpu:
ps auxf | sort -nr -k 3 | head -10
sample output:
[root@amitmaheshwari.in ] # ps auxf | sort -nr -k 3 | head
daemon 10566 2.6 4.2 238580 169756 ? S 14:22 1:23 Rails: /opt/redmine-2.1.2-1/apache2/htdocs/../../apps/redmine/htdocs
root 24790 0.1 0.0 24704 2044 ? Sl 2013 249:44 | \_ PassengerHelperAgent
xfs 23299 0.0 0.0 10288 400 ? Ss 2013 0:02 xfs -droppriv -daemon
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9 0.0 0.0 0 0 ? S< 2013 0:00 [kthread]
root 8 0.0 0.0 0 0 ? S< 2013 0:00 [khelper]
root 7 0.0 0.0 0 0 ? S< 2013 124:04 [events/1]
root 67 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/1]
root 66 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/0]
root 65 0.0 0.0 0 0 ? S 2013 7:11 [kswapd0]
for memory:
ps auxf | sort -nr -k 4 | head
sample output:
[root@amitmaheshwari.in ~] # ps auxf | sort -nr -k 4 | head
daemon 10566 2.5 4.2 238580 169756 ? S 14:22 1:23 Rails: /opt/redmine-2.1.2-1/apache2/htdocs/../../apps/redmine/htdocs
mysql 24711 0.0 1.6 340088 64756 ? Sl 2013 160:39 \_ /opt/redmine-2.1.2-1/mysql/bin/mysqld.bin --defaults-file=/opt/redmine-2.1.2-1/mysql/my.cnf --basedir=/opt/redmine-2.1.2-1/mysql --datadir=/opt/redmine-2.1.2-1/mysql/data --plugin-dir=/opt/redmine-2.1.2-1/mysql/lib/plugin --user=mysql --lower-case-table-names=1 --log-error=/opt/redmine-2.1.2-1/mysql/data/mysqld.log --pid-file=/opt/redmine-2.1.2-1/mysql/data/nhst-empd.com.pid --socket=/opt/redmine-2.1.2-1/mysql/tmp/mysql.sock --port=3306
root 24792 0.0 0.3 38228 12936 ? Sl 2013 47:40 | | \_ Passenger spawn server
xfs 23299 0.0 0.0 10288 400 ? Ss 2013 0:02 xfs -droppriv -daemon
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9 0.0 0.0 0 0 ? S< 2013 0:00 [kthread]
root 8 0.0 0.0 0 0 ? S< 2013 0:00 [khelper]
root 7 0.0 0.0 0 0 ? S< 2013 124:04 [events/1]
root 67 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/1]
root 66 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/0]
for cpu:
ps auxf | sort -nr -k 3 | head -10
sample output:
[root@amitmaheshwari.in ] # ps auxf | sort -nr -k 3 | head
daemon 10566 2.6 4.2 238580 169756 ? S 14:22 1:23 Rails: /opt/redmine-2.1.2-1/apache2/htdocs/../../apps/redmine/htdocs
root 24790 0.1 0.0 24704 2044 ? Sl 2013 249:44 | \_ PassengerHelperAgent
xfs 23299 0.0 0.0 10288 400 ? Ss 2013 0:02 xfs -droppriv -daemon
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9 0.0 0.0 0 0 ? S< 2013 0:00 [kthread]
root 8 0.0 0.0 0 0 ? S< 2013 0:00 [khelper]
root 7 0.0 0.0 0 0 ? S< 2013 124:04 [events/1]
root 67 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/1]
root 66 0.0 0.0 0 0 ? S< 2013 0:00 \_ [aio/0]
root 65 0.0 0.0 0 0 ? S 2013 7:11 [kswapd0]