In this recipe, we are going to use the top command to find the processes that are using a lot of CPU resources.
The top command is a Linux-based utility and it does not work in Unix-based systems. If you are using Solaris then use the
prstat command instead to find CPU intensive processes.
The usage of the top command is shown in the following snippet:
bash-3.2$top Cpu states: 0.0% idle, 82.0% user, 18.7% kernel, 0.8% wait, 0.5% swap Memory: 795M real, 12M free, 318M swap, 1586M free swap PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND 23624 postgres -25 2 208M 4980K cpu 1:20 22.47% 94.43% postgres 15811 root -15 4 2372K 716K sleep 22:19 0.61% 3.81% java 20435 admin 33 0 207M ...