If you get an error while setting the timezone, like:
dev@codetryout:~/devops$ sudo timedatectl set-timezone IST
Failed to set time zone: Invalid or not installed time zone 'IST'
Other examples
failed to set time zone invalid or not installed time zone 'asia/kolkata'
failed to set time zone invalid or not installed time zone 'asia/shanghai'
failed to set time zone invalid or not installed time zone 'europe/berlin'
This is because of incorrect time zone specifications. Let us explore the steps to set the system timezone from the bash/command line.
Listing supported timezone formats
You can find your correct time from the list below:
timedatectl list-timezones
Set timezone
Then, issue the command with an appropriate, supported Time Zone format.
Example:
sudo timedatectl set-timezone Asia/Kolkata
# OR
sudo timedatectl set-timezone Europe/London
Verifying TimeZone
You can use the command timedatectl to see the system timezone.
timedatectl
Example output:
Local time: Fri 2023-08-11 06:13:17 BST
Universal time: Fri 2023-08-11 05:13:17 UTC
RTC time: Fri 2023-08-11 05:13:18
Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no