Skip to main content

How to Set or Change the Time Zone in Linux

A time zone is a geographic region that has the same standard time. Typically the time zone is set during the installation of the operational system, but it can be easily changed at a later time.

Using the correct time zone is essential for many systems related tasks and processes. For example, the cron daemon uses the system’s time zone for executing cron jobs. The time zone is also used for logs timestamps.

This tutorial covers the steps necessary to set or change the time zone in Linux.

Checking the Current Time Zone

timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems.

To view the current time zone, invoke the timedatectl command without any options or arguments:

timedatectl
Output:
                      Local time: Tue 2019-12-03 16:30:44 UTC
                  Universal time: Tue 2019-12-03 16:30:44 UTC
                        RTC time: Tue 2019-12-03 16:30:44
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

The output above shows that the system’s time zone is set to UTC.

The system time zone is configured by symlinking the /etc/localtime file to a binary time zone’s identifier in the /usr/share/zoneinfo directory.

Another way to check the time zone is to view the path the symlink points to using the ls command:

ls -l /etc/localtime
Output:
lrwxrwxrwx 1 root root 27 Dec  3 16:29 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC

Changing the Time Zone in Linux

Before changing the time zone, you’ll need to find out the long name of the time zone you want to use. The time zone naming convention usually uses a “Region/City” format.

To view all available time zones, use the timedatectl command or list the files in the /usr/share/zoneinfo directory:

timedatectl list-timezones
Output:
...
America/Swift_Current
America/Tegucigalpa
America/Thule
America/Thunder_Bay
America/Tijuana
America/Toronto
America/Tortola
America/Vancouver
America/Virgin
America/Whitehorse
America/Winnipeg
America/Yakutat
America/Yellowknife
...

Once you identify which time zone is accurate to your location, run the following command as root or sudo user:

sudo timedatectl set-timezone <your_time_zone>

For example, to change the system’s timezone to America/Toronto you would type:

sudo timedatectl set-timezone America/Toronto

To verify the change, invoke the timedatectl command again:

Output:

Local time: Sun 2023-10-01 09:05:42 EDT
           Universal time: Sun 2023-10-01 13:05:42 UTC
                 RTC time: Sun 2023-10-01 13:05:42
                Time zone: America/Toronto (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no