System timezone is first set during system installation for Ubuntu. The installer automatically selects the timezone based on your current location, though you can choose any timezone from the map for your system.

The system timezone is set using the /etc/localtime file. You can change the timezone of your Ubuntu system after installation by creating a softlink from /etc/localtime to the appropriate timezone info files available in the /usr/share/zoneinfo folder. The other method is to use a helper program such as timedatectl.

Steps to change system timezone in Linux:

  1. Launch terminal.
  2. Check currently-used timezone using timedatectl.
    $ timedatectl
                   Local time: Jum 2020-08-21 09:30:04 +08   
               Universal time: Jum 2020-08-21 01:30:04 UTC   
                     RTC time: Jum 2020-08-21 01:30:04       
                    Time zone: Asia/Kuala_Lumpur (+08, +0800)
    System clock synchronized: yes                           
                  NTP service: active                        
              RTC in local TZ: no
  3. Check for available timezones in the system.
    $ timedatectl list-timezones
    Africa/Abidjan
    Africa/Accra
    Africa/Algiers
    Africa/Bissau
    Africa/Cairo
    Africa/Casablanca
    Africa/Ceuta
    Africa/El_Aaiun
    Africa/Johannesburg
    Africa/Juba
    Africa/Khartoum
    ##### snipped 
  4. Search for your timezone from the list of available timezones.
    $ timedatectl list-timezones | grep -i tokyo
    Asia/Tokyo
  5. Set new timezone using timedatectl.
    $ sudo timedatectl set-timezone Asia/Tokyo
    [sudo] password for user:

    The above command is similar to doing the following two manual steps:

    1. Unlink your currently-used timezone.
      $ sudo unlink /etc/localtime
      [sudo] password for user:
    2. Link /etc/localtime to your new timezone.
      $ sudo ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
  6. Confirm changes using timedatectl.
    $ timedatectl 
                   Local time: Jum 2020-08-21 10:34:29 JST
               Universal time: Jum 2020-08-21 01:34:29 UTC
                     RTC time: Jum 2020-08-21 01:34:29    
                    Time zone: Asia/Tokyo (JST, +0900)    
    System clock synchronized: yes                        
                  NTP service: active                     
              RTC in local TZ: no
Discuss the article:

Comment anonymously. Login not required.