For some people it doesn't matter how long the system has been running, but this is important information for the server administrator. When the server is running important applications,
Must try to ensure long-running stable operation, and sometimes even require zero downtime. So how do we know how long the server has been running? In the Linux system, the following methods can be used to query.
1.uptime Command
2. View the/proc/uptime file calculation system start time
The first number is that the system has been running for 3,563,285,.42 seconds, and the second parameter represents the system's idle time of 24,291,640,.22 seconds. Use the System tool date to calculate the system boot time
[[email protected]5201351date"$ (awk-f. ' {print $} '/proc/uptime) second ago " +"%y-%m-%d%h:%m:%s"
Execute the above command output: 2014-11-07 09:50:10
3. View/proc/uptime file calculation system run time
[Email protected]5201351cat /proc/uptimeawk'{run_days=$1/86400 ; run_hour= ($ 86400)/3600;run_minute= ($ 3600)/60;run_second=$1% 60;printf ("system already running:%d%d seconds%d days", Run_days,run_ Hour,run_minute,run_second)}'
Execute the above command output: The system has been running: 41 days 5:48 5 Seconds
How to view system boot time and run time under Linux