Accurate timezone settings on Linux systems prevent incorrect log timestamps, scheduling conflicts, and other time-dependent issues. Many modern distributions, including Ubuntu, rely on systemd utilities to manage system time, offering both command-line and graphical tools. Proper configuration ensures consistent time reporting across local and remote services.

The primary method of controlling time in Linux involves the symbolic link /etc/localtime, which references data in the /usr/share/zoneinfo directory. By updating this link, administrators can switch to the appropriate regional time. However, most recent distributions provide the timedatectl command as an easier alternative.

timedatectl offers a straightforward way to list available timezones and make adjustments. It also manages other time-related tasks, such as enabling automatic synchronization with NTP servers. These capabilities make timedatectl the recommended approach on systems running systemd.

Steps to change system timezone in Linux:

  1. Open a terminal or console session.
  2. Check the current configuration by running timedatectl.
    $ timedatectl
                   Local time: Mon 2024-05-06 19:06:41 +08
               Universal time: Mon 2024-05-06 11:06:41 UTC
                     RTC time: Mon 2024-05-06 11:06:42
                    Time zone: Asia/Kuala_Lumpur (+08, +0800)
    System clock synchronized: no
                  NTP service: active
              RTC in local TZ: no
  3. List the available timezones with timedatectl list-timezones.
    $ timedatectl list-timezones
    Africa/Abidjan
    Africa/Accra
    Africa/Addis_Ababa
    ...
  4. Search for a specific timezone using grep or by manually scrolling through the list.
    $ timedatectl list-timezones | grep -i tokyo
    Asia/Tokyo
  5. Set the new timezone with timedatectl set-timezone plus the desired region.
    $ sudo timedatectl set-timezone Asia/Tokyo
    [sudo] password for user:
  6. Verify the change by running timedatectl again.
    $ timedatectl
                   Local time: Mon 2024-05-06 20:09:09 JST
               Universal time: Mon 2024-05-06 11:09:09 UTC
                     RTC time: Mon 2024-05-06 11:09:10
                    Time zone: Asia/Tokyo (JST, +0900)
    System clock synchronized: no
                  NTP service: active
              RTC in local TZ: no

    You can manually update /etc/localtime by unlinking the current file and linking it to the correct region in /usr/share/zoneinfo.

Tested on Ubuntu:

Version Code Name
22.04 LTS Jammy Jellyfish
23.10 Mantic Minotaur
24.04 LTS Noble Numbat
Discuss the article:

Comment anonymously. Login not required.