Article Title: how to view the system startup time and running time in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. uptime command
Output: 16: 11: 40 up 59 days, 2 users, load average: 0.00, 0.01, 0.00
2. View/proc/uptime file calculation system startup time
Cat/proc/uptime
Output: 5113396.94 575949.85
The first number is the system running time of 5113396.94 seconds. You can use the system tool date to calculate the system startup time.
Code: select all
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: select all
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
No command is required. Check the system startup time from that file.