一、timedatectl命令
1.使用timedatectl查看时间状态:
[root@jelly ~]# timedatectl
Local time: Mon 2022-03-21 20:53:56 CST
Universal time: Mon 2022-03-21 12:53:56 UTC
RTC time: Mon 2022-03-21 12:53:56
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
2.列出所有时区(因篇幅占用只截取部分作为示例):
[root@jelly ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/El_Aaiun
Africa/Freetown
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
3.修改时区为列出时区的某一个(此处随机选择Africa/Bamako)并查看:
[root@jelly ~]# timedatectl set-timezone "Africa/Bamako"
[root@jelly ~]# timedatectl
Local time: Mon 2022-03-21 13:31:36 GMT
Universal time: Mon 2022