
Change the time zone in Linux using the CLI
It is easy to change the time zone of your Linux server from the command line interface (CLI). The following technique should work on all systemd-derived distros including Redhat, Debian, Ubuntu, Mint, etc.
Check your current time zone
Check your current time zone with the timedatectl command:
$ timedatectlLocal time: Thu 2023-05-18 07:36:40 GMTUniversal time: Thu 2023-05-18 07:36:40 UTCRTC time: Thu 2023-05-18 07:36:40Time zone: GMT (GMT, +0000)System clock synchronized: yesNTP service: activeRTC in local TZ: no
In this instance, the time zone of the server is GMT.
Set a new time zone
Use the timedatectl command again with the set-timezone parameter to set your desired time zone. You will need to use sudo or a root shell:
sudo timedatectl set-timezone Europe/London
Use the timedatectl command again to confirm the change:
$ timedatectlLocal time: Thu 2023-05-18 08:36:47 GMTUniversal time: Thu 2023-05-18 07:36:47 UTCRTC time: Thu 2023-05-18 07:36:47Time zone: Europe/London (BST, +0100)System clock synchronized: yesNTP service: activeRTC in local TZ: no
Viewing available time zones
You can use the timedatectlcommand with the list-timezones parameter to list all available time zones:
$ timedatectl list-timezones
This will help you identify the correct time zone for your location. Be warned, it is rather a long list!