How to check the system time in Linux
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!