Setting and adjusting Timezone on Ubuntu

In this article I will show you how to lookup the current set time zone and how to change it. It is important that your Servers and Workstations are set up with the proper timezone for example if you run scripts triggered by time events as well as your log file to reflect the correct time for the events that happened.

As usual I expect a running Ubuntu server which is fully up2date. If you need help setting up a Ubuntu Server read: Simple Ubuntu Server 20.04 LTS installation walk through

Timezone query

Lets get started. The first command we are going to look at is:

timedatectl

and for this command there is no sudo required. Everybody can query the currently set timezone and it should something like the screenshot below.

timedatectl command to query Timezone
timedatectl command

In this case the timezone has been set to Mountain Standard Time (MST) America/Denver and it is written in the timezone file located at /etc/timezone. You can look at its content with:

more /etc/timezone

Now lets say you like to change the timezone to you location and you are not aware of the proper timezone name. Run the following command to get a list of possible timezones:

Timezone list
Timezone list

This is just a snippet of possible timezone. Run it for yourself and pick the one closest to your location.

Setting Timezone

Now that you picked your timezone lets change the current timezone to your preferred one with the following command:

sudo timedatectl set-timezone America/Dawson

Next run the timedatectl command again to see if the timezone has been successfully changed.

timedatectl

and you should see something similar to the following:

tiimedatectl command to query Timezone
timedatectl command

As you can see the timezone has been successfully changed.

Conclusion

As you can see changing the timezone after system installation is fairly simply and quickly done. If you liked this article drop me a line and perhaps suggest ideas for future articles.

Ciao!