X
  • Tips |
    Friday, February 20, 2009

How to find out CPU utilization in Linux?

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

The 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

To quit "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 apt-get.

$ apt-get install sysstat
To get CPU utilization information, type in following command:

$ mpstat
>

To monitor individual processor performance, issue following command:

$ mpstat -P ALL

The "sar" command

To display CPU utilization using "sar", use following command:

$ sar -u 2 5t

This command will display CPU utilization 2 seconds apart, 5 times as shown below.


The "iostat" command

The 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.

$ iostat

GUI Tools

KDE desktop environment has a system monitor utility whic 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.

Join the discussion

Comments ( 9 )
  • Andrew Collins Thursday, March 12, 2009
    Thanks for the run-down of these tools.
  • Claudia Monday, July 4, 2011

    thanks for providing information that how to use the commands and GUI Interface for monitoring the CPU utilization in Linux..


  • Sathish Wednesday, August 29, 2012

    Thanks, keep posting :)


  • guest Thursday, November 8, 2012

    Super Cool, it resolved my all the issues... Thanks Pranav.....

    Hiren


  • Elex Thursday, July 18, 2013

    Well explained !!!


  • Pawan Sunday, August 4, 2013

    Great, never know some of these commands, thanks for sharing.


  • phim hay Thursday, October 3, 2013

    Thanks, it very helpful


  • guest Thursday, October 3, 2013

    Thanks for this tool.


  • CyrIng Saturday, October 4, 2014

    XFreq provides some Widgets to display the frequencies (including turbo boost), the temperatures, C-States and other features of the Intel Core i7 processors. It is also programmed for Core 2 and other Intel architectures.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha