Use sar to get CPU statistics

You can use the “sar” command to get report about a lot of things about your linux box.

Here I showing you how to get the report of CPU usage using the sar command. Do remember that sar is part of the “sysstat” package. So make sure you install “sysstat” first.

sudo sar -u 1 10 

This command shows the CPU stats for 10 times in an interval of 1 seconds.

If you know how to use “gnuplot” you can then use gnuplot to view this report in graphical manner.

Here is the snapshot from my machine of sar showing CPU statistics.

sar command showing cpu statistics

sar command showing cpu statistics

Advertisements