1. 程式人生 > 其它 >Centos7修改時區、時間

Centos7修改時區、時間

技術標籤:隨筆Linuxlinuxcentos

timedatectl 檢視時間資訊

[[email protected] ~]# timedatectl
      Local time: Fri 2020-12-11 01:19:07 EST
  Universal time: Fri 2020-12-11 06:19:07 UTC
        RTC time: Fri 2020-12-11 06:19:07
       Time zone: America/New_York (EST, -0500)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2020-11-01 01:59:59 EDT
                  Sun 2020-11-01 01:00:00 EST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2021-03-14 01:59:59 EST
                  Sun 2021-03-14 03:00:00 EDT

timedatectl 將硬體時鐘調整為與本地時鐘一致, 0 為設定為 UTC 時間

[[email protected] ~]# timedatectl set-local-rtc 1

timedatectl 修改本機時區

[[email protected] ~]# timedatectl set-timezone Asia/Shanghai

同步本機時間

[[email protected] ~]# ntpdate ntp1.aliyun.com
11 Dec 14:20:13 ntpdate[7704]: adjust time server 120.25.115.20 offset 0.003745 sec
[
[email protected]
~]# date Fri Dec 11 14:20:22 CST 2020

ntpdate 工具安裝方法

yum -y install ntp

參考