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
topcommand — shows real-time CPU load, memory usage, and process list. - The
htopcommand — an improved version oftopwith a user-friendly interface. - The
uptimecommand — displays the average load over 1, 5, and 15 minutes. - The
mpstatcommand (from the sysstat package) — shows statistics for each core. - Reading the
/proc/loadavgfile — contains the average load values. - The
vmstatcommand — 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.