Linux 101 : CPU load - top, uptime, ... -



Displaying the CPU load:

We can display the CPU load using the below command:


We could see the the below information in the output of the command:
  • The current time "08:18:02".
  • The time passed since the last reboot "83" days.
  • The number of users "3".
  • The CPU load for the past "5" minutes "0.12", "10" minutes "0.20" and "15" minutes "0.24".
Example of CPU loads:

A "1.5" CPU load on a system, means that the CPU is running at full capacity, and that "50" percent of the running processes are waiting for some CPU time.

A "1.5" load on a two CPUs system would mean that the CPU is running at "75" per cent of its capacity.

Because these number are tied to the number of processors our system has, we would need to know the exact number of these CPUs.

To display that information, we use the below command:


We see that our system has "four" processors.

The "top" command:

The top command also displays that information "live".

Below is an example of the top command:


That way, we could detect the processes that consumes lot of CPU power and stop or restart them.

We could restart a service using the below command:


Or, we could stop it using the command below:


Remark:

While the top command is running, we could use the < Shift+P > key combination to sort the processes according to their CPU consumption.

Comments

Leave as a comment:

Archive