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:
# 查询Linux系统运行时间[[email protected]_aliyun ~]# uptime22:36:32 up 10 days, 11:21, 1 user, load average: 0.00, 0.05, 0.07
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 left the first message is 22:36:32, this is the current system time, in 24-hour format output. System uptime the second message up to ten days, 11:21, which is to show your system uptime. Show that your system has been running for 10 days, 11 hours, 21 minutes, if your system is not running for more than 24 hours, this will only show hours minutes or only minutes. When the system restarts, it will be zeroed out.
[[email protected] ~]# uptime23:02:03 up 2 min, 2 users, load average: 0.00, 0.00, 0.00
Number of logged in users the third part of the information is to show the number of logged-in users. The display is 1 user, which is the number of currently logged in 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 the last information is the average load of the system. You see this number with two decimal places 0.00, 0.05, 0.07 can be converted into percentages, i.e. 0.00 and 0.05 represent 0% and 5% respectively. 0.00, 0.05, 0.07 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.
See how long the CentOS system is running using the uptime command