CentOS set system time to synchronize with network time

Reprinted from: http://www.linuxidc.com/Linux/2016-07/133755.htm

Linux time is divided into System Clock (system time) and Real Time Clock (hardware time, RTC for short).

System time: refers to the time in the current Linux Kernel.

Hardware time: Time when there is battery power on the motherboard.

Command to view system time: #date

Command to set system time: #date –set (month/day/year hour:minute:second)

例:#date –set “10/11/10 10:15”

Command to view hardware time: # hwclock

Command to set hardware time: # hwclock –set –date = (month/day/year hour:minute:second)

The above mentioned is to manually set the time to a point in time, which may be different from the time of the current network. The following describes the method of synchronizing with the time on the time server

  1. Install the ntpdate tool

yum -y install ntp ntpdate

  1. Set the system time to synchronize with the network time

ntpdate cn.pool.ntp.org

  1. Write system time to hardware time

hwclock –systohc

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325575848&siteId=291194637