Home  »  ArticlesGuidesHow ToTechnologyTools   »   Change Time Zone on Ubuntu 20.04 | 18.04 With These Tips

Change Time Zone on Ubuntu 20.04 | 18.04 With These Tips

Usually, you would set the correct time zone during the setup of your Ubuntu Server system. In case this did not happen or a mistake was made, there are some ways to change the time zone on Ubuntu systems using the command-line interface.

Just to be on the same page, a time zone refers to a designated area of the globe that observes a uniform standard time. They are usually set using country boundaries or regional boundaries within a country, especially for larger ones.

Confirm the Current Timezone

Run the following command:

$ date

Example Output:

Thu Jan 7 21:26:59 UTC 2021

The above command shows that this system is running in the UTC timezone.

The same can be achieved but with more detail by running:

$ timedatectl

The expected output is:

                      Local time: Thu 2021-01-07 21:29:05 UTC
                  Universal time: Thu 2021-01-07 21:29:05 UTC
                        RTC time: Thu 2021-01-07 21:29:06
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Now Let’s Change the Time Zone on Ubuntu 20.04

Option 1 – Using timedatectl

You can find all the available time zones on your system. That way you can know the correct one to pick out.

$ timedatectl list-timezones

Search for the preferred time zone name from the list then uses one of the following commands to set the new time zone on your system.

$ sudo timedatectl set-timezone "America/New_York"

The “America/New_York” portion of the above command without quotes is what was retrieved from the list. You can get a comprehensive time zone list here.

Option 2 – Using /etc/localtime

This is a more involving method and it’s a bit of a hack but nevertheless, it is an alternate option that you can use to change the time zone on Ubuntu.

First, rename the /etc/localtime file to keep it as a backup.

$ mv /etc/localtime /etc/localtime-backup

Change the symbolic link of the file to the correct time zone configuration file. Find out more about how to create symbolic links in Linux from this post here.

$ ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

That’s it. You can confirm the changes by running the timedatectl command again.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Available under:
Articles, Guides, How To, Technology, Tools