Change Time Zone for RHEL/CentOS and Fedora
This post shows how to query and set the time zone in the command line on RHEL 8, CentOS 8 and Fedora 30. The command line tool timedatectl
use to check and modify time zone setting.
Run the query using timedatectl
without additional arguments:
1 2 3 4 5 6 7 8 9 |
$ timedatectl Local time: Wed 2021-02-17 17:04:29 GMT Universal time: Wed 2021-02-17 17:04:29 UTC RTC time: Wed 2021-02-17 16:57:58 Time zone: Europe/London (GMT, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no |
Now set the time zone to another zone:
1 2 |
$ sudo timedatectl set-timezone Europe/Zurich |
To query the changed time zone setting:
1 2 3 4 5 6 7 8 9 |
$ timedatectl Local time: Wed 2021-02-17 18:05:58 GMT Universal time: Wed 2021-02-17 17:05:58 UTC RTC time: Wed 2021-02-17 16:59:27 Time zone: Europe/Zurich (CET, +0100) System clock synchronized: yes NTP service: active RTC in local TZ: no |
The available time zones showing with the following command:
1 2 |
$ timedatectl list-timezones |
Since there are many time zones, the query becomes very long; the query can be narrowed down with grep:
1 2 |
$ timedatectl list-timezones | grep Europe |