Show current timezone status:
$ timedatectl show
Timezone=Asia/Shanghai
LocalRTC=no
CanNTP=yes
NTP=yes
NTPSynchronized=yes
TimeUSec=Wed 2021-09-08 16:53:35 CST
RTCTimeUSec=Wed 2021-09-08 16:53:35 CST
$ timedatectl status
Local time: Wed 2021-09-08 16:53:50 CST
Universal time: Wed 2021-09-08 08:53:50 UTC
RTC time: Wed 2021-09-08 08:53:50
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
List timezones:
$ timedatectl list-timezones |grep -i shanghai
Asia/Shanghai
Set timezone:
$ sudo timedatectl set-timezone Asia/Shanghai
Unix 的习惯是如果没有返回任何信息表示成功!