How to view system boot time and run time under Linux (RPM)

Source: Internet
Author: User

1.uptime command
Output: 16:11:40 up, 4:21, 2 users, load average:0.00, 0.01, 0.00

2. View the/proc/uptime file calculation system start 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 tool date to calculate the system boot time

Code: Select All
date -d "$(awk -F. ‘{print $1}‘ /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"


Output: 2008-11-09 11:50:31

3. View/proc/uptime file calculation system run time

Code: Select All
cat /proc/uptime| awk -F. ‘{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("系统已运行:%d天%d时%d分%d秒",run_days,run_hour,run_minute,run_second)}‘


Output: System has been running: 59 days 4:13 9 seconds

How to view system boot time and run time under Linux (RPM)

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.