$> ps waux --sort=-pcpu
If you piped the result into the head command, you can limit the result to the n entries with the highest CPU usage.
$> ps waux --sort=-pcpu | head -n 10
In this example you will see the ten most CPU-consuming processes on the machine. The ‘–‘ before pcpu results in a descending order.
Example output:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND kd249069 2686 11.5 4.9 1462144 1230768 pts/1 S+ 01:30 111:32 /usr/lib64/php5/5.4.38/bin/php product_import.php -target products -testmode kd176735 2302 7.1 1.0 400296 259460 ? R May07 139:53 /usr/bin/php5-5.3.8-cgi kd176735 2303 6.3 0.9 385040 238712 ? S May07 124:50 /usr/bin/php5-5.3.8-cgi kd176735 2301 5.9 1.0 396320 255652 ? S May07 116:38 /usr/bin/php5-5.3.8-cgi kd176735 7074 5.7 0.7 319384 176952 ? S May07 82:06 /usr/bin/php5-5.3.8-cgi kd176735 30571 5.7 0.6 307956 167248 ? S May07 98:18 /usr/bin/php5-5.3.8-cgi kd176735 30573 5.5 0.8 353852 211716 ? S May07 93:43 /usr/bin/php5-5.3.8-cgi kd176735 30572 5.4 0.8 341068 198780 ? S May07 93:18 /usr/bin/php5-5.3.8-cgi kd176735 29817 5.3 0.8 345640 202672 ? S May07 67:20 /usr/bin/php5-5.3.8-cgi
To see what happens in a particular process you can observe the process with strace.
1 thoughts on “List processes after CPU usage”