Home > loader > how to check load average in linux

how to check load average in linux

Release time:2023-06-29 22:17:59 Page View: author:Yuxuan
In a Linux system, the load average represents the average number of active tasks over a certain period of time. It is a useful metric that can indicate if the system is overloaded or not, and it can be used to diagnose performance issues. In this article, we will show you how to check the load average in Linux.

Method 1: Using the uptime Command

The easiest way to check the load average in Linux is by using the uptime command. This command displays the system uptime, the number of logged-in users, and the load average for the past 1, 5, and 15 minutes.Open a terminal and type the following command:

uptime

The output should look something like this:

15:42:54 up 3 days, 1:45, 1 user, load average: 0.00, 0.01, 0.05

The load average is shown in the last part of the output. In this example, the load average is 0.00 for the last minute, 0.01 for the last 5 minutes, and 0.05 for the last 15 minutes. A load average of 1.00 means that the system is fully loaded, while a value below 1.00 indicates that there is room for more tasks.

Method 2: Using the top Command

Another way to check the load average in Linux is by using the top command. This command displays a dynamic real-time view of the processes running on the system, including the CPU usage and the load average.Open a terminal and type the following command:

top

The output should look something like this:

top - 15:53:57 up 3 days, 1:56, 1 user, load average: 0.14, 0.10, 0.06Tasks: 207 total, 1 running, 206 sleeping, 0 stopped, 0 zombie%Cpu(s): 2.1 us, 0.9 sy, 0.0 ni, 96.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stMiB Mem : 7980.3 total, 536.1 free, 5234.7 used, 2209.6 buff/cacheMiB Swap: 2048.0 total, 1974.9 free, 73.1 used. 1754.7 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME COMMAND 1902 john 20 0 1680136 444812 96028 S 3.6 5.5 4:12.15 gnome-shell 2692 john 20 0 558460 33884 22532 S 3.6 0.4 0:01.56 gnome-terminal- 2147 john 20 0 831184 16696 12004 S 1.8 0.2 0:03.57 Xorg 2985 john 20 0 1772828 208132 94508 S 1.5 2.6 0:59.70 firefox 1861 john 20 0 292024 54744 31392 S 1.2 0.7 0:13.49 gnome-software 2281 john 20 0 1195396 102380 50868 S 1.2 1.3 0:15.30 ibus-daemon 3093 john 20 0 1402676 172732 73616 S 0.9 2.1 0:25.73 brave

The load average is shown in the first line of the output, just after the system uptime. In this example, the load average is 0.14 for the last minute, 0.10 for the last 5 minutes, and 0.06 for the last 15 minutes.

Method 3: Using the sar Command

The sar command (System Activity Report) is a powerful tool that can be used to collect, report, and analyze system performance data. It can display various metrics, including the load average.To use the sar command, you need to install the sysstat package:

sudo apt-get install sysstat

Once the package is installed, you can use the sar command to display the load average for the current day:

sar -q

The output should look something like this:

Linux 4.15.0-151-generic (ubuntu) Sunday 14 November 2021 _x86_64_ (4 CPU)12:00:01 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked12:10:01 AM 0 621 0.67 0.67 0.64 012:20:01 AM 0 617 0.17 0.25 0.47 012:30:01 AM 0 618 0.21 0.24 0.39 012:40:01 AM 0 618 0.17 0.19 0.32 012:50:01 AM 0 616 0.14 0.16 0.28 0

The load average is shown in the ldavg-1, ldavg-5, and ldavg-15 columns. In this example, the load average is 0.67 for the last minute, 0.67 for the last 5 minutes, and 0.64 for the last 15 minutes.

Conclusion

Checking the load average is an important task for system administrators, as it can indicate if a system is overloaded or not. In this article, we have shown three different methods for checking the load average in Linux: using the uptime command, using the top command, and using the sar command. Choose the method that suits your needs best and use it regularly to keep an eye on your system's performance.
THE END

Not satisfied with the results?