Everyone knows that CPU utiization in windows can be found out from Windows Task Manager. But what about Linux? Well Linux has also got set of utilities to monitor CPU utilization. With these commands you can find out total CPU utilization, individual CPU utilization (for SMP machines), your system’s average CPU utilization since the last reboot, determine which process is eating up your CPU(s) etc.
Good old “top” command
top command provides dynamic view of CPU utilization. It displays system information as well as list of tasks currently managed by kernel. Is also displays uptime, average load, physcal and swap memory utilization. Syntax of
top command is as follows:
top, you have to press
Q key of your keyboard.
Using “mpstat” command
To use this command, you have to install a package called
sysstat. For Ubuntu or Debian systems, you can install this package using
1 $ apt-get install sysstat
To get CPU utilization information, type in following command:
1 $ mpstat
To monitor individual processor performance, issue following command:
1 $ mpstat -P ALL
The “sar” command
To display CPU utilization using
sar, use following command:
1 $ sar -u 2 5
This command will display CPU utilization 2 seconds apart, 5 times as shown below.
##The “iostat” command
iostat command reports Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. It can be use to find out your system’s average CPU utilization since the last reboot.
1 $ iostat
KDE desktop environment has a system monitor utility which shows CPU utilization as well as many more information. You can also kill a process using this utility as shown below:
It also gives CPU load information, physical and swap memory usage data in graphical format as shown below:
For learning more about above commands and their options, you can go through their man pages.