How to Find Out CPU Utilization in UNIX
Keeping track of your CPU’s performance is extremely important. In UNIX, you can accomplish this task by using the system utilities and commands. For those who would like to find out their CPU utilization, one command is extremely important. It is called SAR – System Activity Reporter.
The SAR commands make accessing CPU performance quite easy. Some simple commands to retrieve CPU utilization include:
The above command will display the current CPU usage.
The above command will display the entire day’s CPU usage.
# sar -u 12 5
The above command will display the CPU usage 5 times at 12-second intervals. It should be noted that sar t [n] can be used to assign the time between each display (t equals time and n equals number).
Other command features for outputs include:
- %sys: This command is used to view the percentage of the CPU used for the system time.
- %usr: This command is used to view the percentage of the CPU for the user.
- %oidle: This command is used to view the percentage of the CPU that is currently idle.
The above commands can be used for all versions of operating systems under UNIX.