How to view system startup time and run time with/proc/uptime2010-05-30 14:36:30 under Linux
Classification:
/proc/uptime
This file gives the number of seconds since the last system bootstrap, and how many seconds are idle. This is mainly for uptime program use. Comparing these two numbers will tell you the proportion of CPU cycles wasted in the long run.
------------------------------------------------1.uptime Command
Output: 16:11:40 up, 4:21, 2 users, load average:0.00, 0.01, 0.00
2. View/proc/uptime file Computing system startup time
Cat/proc/uptime
Output: 5113396.94 575949.85
The first number is the system has been running for 5,113,396,.94 seconds, using the System Tools date to calculate the system start time
Code: All Date-d "$ (awk-f. ' {print} '/proc/uptime) second ago" + "%y-%m-%d%h:%m:%s"
Output: 2008-11-09 11:50:31
3. View/proc/uptime files calculate system run time
Code: Select All cat/proc/uptime| Awk-f. ' {run_days=$1/86400;run_hour= (% 86400)/3600;run_minute= (% 3600)/60;run_second=$1% 60;printf ("system is running:%d days% D%d minutes%d sec \ n ", Run_days,run_hour,run_minute,run_second)} '
Output: System is running: 59 days 4:13 9 seconds