On Linux, the systems timezone is set during the install, but it can be easily changed at a later time.
Using the correct timezone is important for many systems related tasks and processes.
For example, the cron daemon uses the systems timezone for executing cron jobs, and the timestamps in the log files are based on the same systems timezone.
This tutorial explains how to set or change the timezone on AlmaLinux 8.x and 9.x
To be able change the systems timezone youll need to be logged in as root or user with sudo privileges.
Checking the Current Timezone
In modern Linux distros, you can use the timedatectl command to display and set the current systems time and timezone.
The output below shows that the systems timezone is set to UTC:
Local time: Sun 2023-01-15 15:41:56 UTC
Universal time: Sun 2023-01-15 15:41:56 UTC
RTC time: Sun 2023-01-15 15:41:57
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes
Before changing the timezone, youll need to find out the long name for the timezone you want to use.
The timezone naming convention usually uses a Region/City format.
To list all available time zones, use the timedatectl command:
# timedatectl list-timezones
Once you identify which time zone is accurate to your location:
# timedatectl set-timezone your_time_zone
For example, to change the systems timezone to America/Toronto:
# timedatectl set-timezone America/Toronto
Run the timedatectl command to verify the changes:
KB Article Written: 2023 January 15