fbpx Linux Uptime Command: View System Uptime and Load | Certificação Linux

Linux Uptime Command: View System Uptime and Load

📅 12/08/2021 ⏱ 3 min ✍️ Uira Ribeiro
Linuxcommands
Linux Uptime Command: View System Uptime and Load
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

The uptime command in Linux shows how long the system has been running, the number of logged-in users, and the CPU load.

The most common options are:

  • -p        Shows how long the system has been up in a "nice" format
  • -s        Shows how long the system has been up in YEAR-MONTH-DAY HOUR:MINUTE:SECOND format

The CPU load averages shown by the uptime command are calculated as the average of processes running or waiting for the CPU. These averages are not normalized by the number of CPUs.

It is very important to remember that uptime shows the CPU load average for 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 the system has only one CPU, it means the CPU usage is beyond capacity, therefore there is a large wait for CPU by the processes.

But to draw more accurate conclusions, it depends on how long the CPU average has been above 1. If there was a CPU usage spike in the last minute, but the load averages for the 5 and 15 minute periods are low, it is not an indication that there is a need to replace the CPU. But if the averages are also high at 5 and 15 minutes, it means 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 system with 4 processors means the CPUs are idle 75% of the time. This way, you can understand that to overload a system with 4 CPUs, the average load needs to be greater than 4.

See in this example that there is CPU to spare:

$ uptime 20:35:37 up 31 days,  9:41,  1 user,  load average: 0,02, 0,02, 0,00

The -p option shows how long the system has been up in a day-counting style:

$ uptime -pup 4 weeks, 3 days, 9 hours, 45 minutes

And the -s option shows how long the system has been up in date format:

$ uptime -s2019-08-15 10:53:45

The number of CPUs in a system can be viewed in the /proc/cpuinfo file, with the "model name" parameter:

$ grep -c 'model name' /proc/cpuinfo1

Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.

Liked it? Share

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp