1.uptime Command
[SQL]View Plaincopy
- [Email protected] log_data]$ uptime
- 09:18:01 up 20:17, 1 user, load average:0.13, 0.12, 0.14
2. View the/proc/uptime file calculation system start time
[SQL]View Plaincopy
- [Email protected] log_data]$ Cat/proc/uptime
- 73064.44 276161.85
Output: 73064.44 276161.85 The first number is the system has been running for 73064.44 seconds, using the System tool date to calculate the system boot time
Code:
[SQL]View Plaincopy
- [[email protected] log_data]$ date-d "$ (awk-f. ' {print $} '/proc/uptime) second ago" +"%y-%m-%d%h:%m:%s"
- 2015-12-02 13:00:59
3. View/proc/uptime file calculation system run time
Code:
[SQL]View Plaincopy
- [Email protected] log_data]$ cat/proc/uptime| Awk-f. ' {run_days=$1/86400;run_hour= ($ 86400)/3600;run_minute= ($ 3600)/60;run_second=$1% 60;printf ("The system has been
View the last boot time and run time of the CentOS system