Linux uptime command (uptime)
The Linux Uptime Command shows how long the system has been on the air, the number of users logged in, and the CPU load.
The most common options are:
- -p Show when the system has been connected in a “cute” way
- -s Shows since when the system has been connected in the format YEAR—MONTH—DAY HOUR:MINUTE:SECOND
The CPU load averages shown by the uptime command are calculated with an average of the processes running or waiting for the CPU. These averages are not normalized by the number of CPUs.
It’s very important to remember that uptime shows the average CPU load in the last 1 minute, the last 5 minutes, and the last 15 minutes, in that order.
If the CPU load is greater than 1, and if the system has only one CPU, it means that the CPU usage is beyond capacity, so there is a long wait per CPU for processes.
But to draw more accurate conclusions, it will depend on the time when the average CPU is above 1. If there was a peak in CPU usage at the last minute, but the average load at times of 5 and 15 minutes are low, it is not an indication that there is a need to change the CPU. But if the averages are high at 5 and 15 minutes too, it means that the processing capacity may be poorly planned in relation to the system load.
It is also important to know that these averages are not normalized by the number of processors. A load number of 1 on a 4-processor system means that the CPUs are idle 75% of the time. Thus, it can be understood that to overload a system with 4 CPUs, the average load must be greater than 4.
In this example, see that there are plenty of CPUs:
The -p option shows when the system has been connected in the day count style since:
And the -s option shows how long the system has been connected in the date format:
The number of CPUs in a system can be viewed in the /proc/cpuinfo file, with the “model name” parameter:
Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it?
Share