检查当前时区
timedatectl
如下面的输出所示,当前系统的时区为:”Asia/Shanghai“
root@debian:~# timedatectl
Local time: Tue 2021-08-03 22:25:01 CST
Universal time: Tue 2021-08-03 14:25:01 UTC
RTC time: Tue 2021-08-03 14:25:02
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
更改时区
列出所有可用时区:
timedatectl list-timezones
root@debian:~# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
...
例如,要将系统的时区更改为 Asia/Shanghai
,您可以运行:
timedatectl set-timezone Asia/Shanghai