How to view system boot time and run time under Linux

Source: Internet
Author: User

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

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.