Check how long the CentOS system has been running the uptime command
It does not matter how long the system has been running for some people, but it is very important for the server administrator. When running important applications, the server must ensure stable operation for a long period of time, and sometimes even require zero downtime. So how can we know how long the server has been running? In Linux, we can use the uptime command, and this command does not require the root permission. The uptime command has been installed by default in the system.
Syntax:
# Query the Linux running time [root @ dev_aliyun ~] # Uptime22: 36: 32 up 10 days, 1 user, load average: 0.00, 0.05, 0.07
This information is stored in the/proc/uptime file. Although it is saved in text format, the data cannot be directly displayed. Therefore, we need to use the uptime command to translate it. The following describes how to interpret the information provided by uptime:
The first message starting from the system time on the left is 22:36:32, which is the current system time and is output in 24-hour format. The second message about the system running time is up for 10 days, indicating the system running time. It indicates that your system has been running for 10 hours, 11 hours, and 21 minutes every day. If your system has not been running for more than 24 hours, only hours or minutes are displayed. After the system is restarted, it will be cleared.
[root@tianyi ~]# uptime23:02:03 up 2 min, 2 users, load average: 0.00, 0.00, 0.00
The third part shows the number of logged-in users. 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 tells you the number of users.
The last information about the average load is the average load of the system. As you can see, the numbers 0.00, 0.05, and 0.07 with two decimal places can be converted into percentages, that is, 0.00 and 0.05 represent 0% and 5% respectively. 0.00, 0.05, 0.07 represents the average load of the system in the past 1 minute, 5 minutes, and 15 minutes. The lower the load, the better the system performance.
This is the daily Usage Guide of the uptime command. To obtain more detailed information, enter man uptime to go to the manual page of the uptime command.