1. uptime Command uptime output: 16: 11: 40up59days, 2 users, loadaverage: 0.00, 0.01, 0.00, as shown in: 2. view/proc/uptime file calculation system startup time cat/proc/uptime output: 5113396.9457594
1. uptime Command
uptime
Output: 16: 11: 40 up 59 days, 2 users, load average: 0.00, 0.01, 0.00
As shown in:
2. View/proc/uptime file calculation system startup time
cat /proc/uptime
Output: 5113396.94 575949.85 the first digit is the system running time of 5113396.94 seconds. The system startup time can be calculated using the system tool date.
Code:
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
Output: 11:50:31
3. view the running time of the/proc/uptime file computing system.
Code:
Cat/proc/uptime | awk-F. '{run_days = $1/86400; run_hour = ($ 1% 86400 3600)/1%; run_minute = ($3600 1%)/60; run_second = $60; printf ("The system is running: % d Day % d hour % d minute % d Second ", run_days, run_hour, run_minute, run_second )}'
Output: The system is running: 04:13:09, 59 days