Linux date time Settings sync command share
- 2020-08-22 23:26:51
- OfStack
date command:
#date
Display system time
hwclock command (i.e. hardwareclock system hardware time)
#hwclock
Display hardware time
#hwclock -w
Writes the system time to the system hardware
ntpdate
ntpdate is an linux time synchronization service software. For detailed information, please refer to Baidu. There are many detailed information
Check to see if the ntpdate service is installed on your machine. If not, ask yum ES38en-ES39en ntpdate
Synchronization time
Enter ntpdate ES48en.nist.gov synchronization network time
Results :3 Jun 15:42:39 ntpdate[4721]: adjust time server 211.115.194.21 ES59en-0.005885 sec
The above results represent the success of time synchronization, which roughly means that the adjustment time is server 211.115.194.21, with a difference of -0.005885 seconds
If the above ES65en. nist. gov server cannot be synchronized, you can try the following time server:
time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org
Adjust hardware time after synchronization time is successful
#hwclock -w
After successful execution, check the system hardware time (barring any surprises, the actual time of date and hwclock is now internet time)
#date
#hwclock
Execute the above command, and the display time should be 1
Timed time synchronization tasks are performed, so we use ES110en-e to add timed tasks
/1 ntpdate time.nuri.net;hwclock -w
That is: # Synchronize 1 internet time every 1 hour and write to hardware