CentOS View the system's last boot time and run time

Source: Internet
Author: User
1.uptime command
[Spark@master log_data]$ uptime
 09:18:01 up 20:17,  1 user,  load average:0.13, 0.12, 0.14

2. View/proc/uptime file Computing system startup time
[Spark@master 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 Tools date to calculate the system start time
Code:
[Spark@master 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 files calculate system run time
Code:
[Spark@master log_data]$ 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, Run_days,run_hour,run_minute,run_second)} '
system is running: 0 days 20:19 26 seconds




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.