« Add "Open with Notepad" to the Context Menu for All Files | Main | How to send message to users logged on to a UNIX terminal? »

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.

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mt/mt-tb.cgi/10163

Comments (1)

Thanks for the run-down of these tools.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on February 20, 2009 4:16 PM.

The previous post in this blog was Add "Open with Notepad" to the Context Menu for All Files.

The next post in this blog is How to send message to users logged on to a UNIX terminal?.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type and Oracle