How To Set or Change Timezone in Linux

  • May 1, 2023
  • 0 Comments

On Linux, the system’s 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 system’s timezone for executing cron jobs, and the timestamps in the log files are based on the same system’s timezone.

This tutorial explains how to set or change the timezone on AlmaLinux 8.x and 9.x

 

Prerequisites

To be able change the system’s timezone you’ll 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 system’s time and timezone.

# timedatectl


The output below shows that the system’s 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

 

Changing Timezone

Before changing the timezone, you’ll 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 system’s timezone to America/Toronto:

# timedatectl set-timezone America/Toronto


Run the timedatectl command to verify the changes:

timedatectl

 


KB Article Written: 2023 January 15

How helpful was this article to you?

Posting has been disabled.