Sobes.tech
Junior — Middle

What ways can be used to determine the current CPU load in the Linux operating system?

sobes.tech AI

Answer from AI

In Linux, there are several ways to determine the current CPU load:

  • The top command — shows real-time CPU load, memory usage, and process list.
  • The htop command — an improved version of top with a user-friendly interface.
  • The uptime command — displays the average load over 1, 5, and 15 minutes.
  • The mpstat command (from the sysstat package) — shows statistics for each core.
  • Reading the /proc/loadavg file — contains the average load values.
  • The vmstat command — displays system statistics, including CPU.

Example of using top:

top

Example of reading the average load:

cat /proc/loadavg

The load average shows the average number of processes waiting to be executed, reflecting the CPU load.