Follow these steps to monitor the CPU
Step 1 : To start top, simply type in top in your command prompt and press Enter
Step 2 : You can use the htop command.
Step 3 : The command pidstat can be used to monitor CPU utilization by an individual process or program. You will need to install sysstat
Step 4 : With pidstat, you can also query statistics for a specific process by its process ID or PID, as follows:
Step 5 : The other useful command is vmstat
Step 6 : Another command for getting processor statistics is mpstat.
Step 7 : One more command, sar (System Activity Reporter), gives details of system performance. To get current CPU utilization using sar, specify the interval, and optionally, counter values.
The command will output 5 records at an interval of 3 seconds.