常用操作
(1) 通過timedatectl管理時間
# 查看時間 timedatectl //等同於 timedatectl status # 設置時間 timedatectl set-time "YYYY-MM-DD HH:MM:SS" # 列出時區 timedatectl list-timezones # 設置時區 timedatectl set-timezone Asia/Shanghai
(2) ntpdate時間同步
yum -y install ntpdate && ntpdate ntp1.aliyun.com # 其他服務器 ntpdate us.pool.ntp.org ntpdate hk.ntp.org.cn ntpdate stdtime.gov.hk 0.asia.pool.ntp.org 1.asia.pool.ntp.org
(3) 通過date管理時間
# 查看時間 data -R # 設置時間 date -s "YYYY-MM-DD HH:MM:SS" # 設置時區 mv /etc/localtime /etc/localtime.bak ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime