Generate the CPU utilization report

sar -u 2 5
Generated the CPU utilization stats with 5 lines /every 2 seconds. Needs sysstat package to be installed prior to use sar.
Sample Output
sar -u 2 5
Linux 2.6.27-11-generic (desktop) 	03/01/2009 	_i686_

09:52:36 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
09:52:38 PM     all     10.49      0.00      1.22      0.00      0.00     88.29
09:52:40 PM     all      7.80      0.00      0.98      0.00      0.00     91.22
09:52:42 PM     all      5.15      0.00      0.25      0.00      0.00     94.61
09:52:44 PM     all      6.80      0.00      0.73      0.00      0.00     92.48
q09:52:46 PM     all      3.18      0.00      0.73      0.00      0.00     96.09
Average:        all      6.69      0.00      0.78      0.00      0.00     92.53

By: rockon
2009-03-02 04:54:37

What Others Think

bash: sar: command not found
phage · 640 weeks and 6 days ago
sudo apt-get install sysstat yum install sysstat Pick your poison.
kaedenn · 637 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: