For some people it doesn't matter how long the system has been running, but this is important information for the server administrator. When running important applications, the server must try to ensure long-running stability, and sometimes even require zero downtime. So how do we know how long the server has been running?
Under Linux, we can use the uptime command, and this command does not have to use root permissions. The uptime command is already installed by default in the system.
The syntax is as follows:
$ uptime
You will see the following display on the screen:
This information is saved in the/proc/uptime file, although it is saved as text, but the data is not displayed directly, which requires us to use the uptime command to translate it.
Here's how to interpret the information provided by uptime:
System Time
In Figure 1, the first message from the left is 14:04:39, which is the current system time, output in 24-hour format.
System Run Time
The second message up 1004 days, 12:20, which is showing your system uptime. Figure 1 shows that your system has been running for 1004 days, 12 hours and 20 minutes, and if your system is not running for more than 24 hours, it will only show hours minutes or only minutes. Note the information in Figure 2 and Figure 3, which will be zeroed out when the system restarts.
number of logged-in users
The third part of the information is to show the number of users logged in. In Figure 1, the 1 user is displayed, that is, the number of currently logged on users. When multiple users log on to the system at the same time, the uptime command will tell you the number of users.
average load capacity
The last message is the average load on the system. Back to Figure 1, you see such a number with two decimal places 0.25, 0.25, 0.19 can be converted into percentages, that is, 0.25 and 0.19 represent 25% and 19% respectively. 0.25, 0.25, 0.19 represent the average load of the system over the past 1 minutes, 5 minutes, and 15 minutes respectively. A lower load means that your system performance is better.
This is the daily use of the uptime command, if you want to get more detailed information, please enter the man uptime into the Uptime Command manual page to view.
How long has your machine been running? Post your uptime and show it to everyone.
CentOS under Uptime command