ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
View the current time zone
command: "date -R" to
view the time and date
Command: "date"
Write the current time and date into the BIOS to avoid invalidation after restarting the
command: "hwclock -w"
Note:
date
without parameters, you can directly see the current date and time
cal
Without parameters, you can directly see this month's calendar
Install the plugin ntpdate
sudo yum install ntp
NTP synchronization time
ntpdate -u cn.pool.ntp.org
NTP has two clock synchronization methods under Linux, namely direct synchronization and smooth synchronization:
direct synchronization
is performed using the ntpdate command, and time is changed directly. If there is a task running at 12:00 on the server, the current server time is 13:00, but the standard time is 11:00. Using this command may cause the task to be executed repeatedly. Therefore, using ntpdate synchronization may cause risks, so this command is also used for the first time synchronization when configuring the clock synchronization service.
Smooth synchronization
uses ntpd for clock synchronization, which can ensure that a time does not go through twice, the offset of each synchronization time will not be too steep, it is slow, and because of this, ntpd smooth synchronization may take time comparison long.
Standard Clock Synchronization Service
http://www.pool.ntp.org/zone/cn website includes global standard time synchronization services, including synchronization of Chinese time, the corresponding URL is cn.pool.ntp.org, in which Also describes the suggested writing in the ntp configuration file:
server 1.cn.pool.ntp.org
server 3.asia.pool.ntp.org
server 2.asia.pool.ntp.org