Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the system time in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to check the system time in Linux, I believe that many inexperienced people don't know what to do about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1.uptime command

Output: 16:11:40 up 59 days, 4:21, 2 users, load average: 0.00,0.01,0.00

two。 Check the / proc/uptime file to calculate the system startup time

Cat / proc/uptime

Output: 5113396.94 575949.85

* the number is the time that the system has been running for 5113396.94 seconds. The system startup time can be calculated by using the system tool date.

Code:

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 to calculate the system run time

Code:

Cat / proc/uptime | awk-F. '{run_days=$1 / 86400scatter runwings hourly = ($1% 86400) / 3600th runners minute = ($1% 3600) / 60th runners secondhands 1% 60ash printf ("system has run:% d days% d hours% d minutes d seconds", run_days,run_hour,run_minute,run_second)}'

Output: system running: 59 days 04:13:09

After reading the above, have you mastered how to check the system time in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report