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
Lets get started. The first command we are going to look at is:
and for this command there is no sudo required. Everybody can query the currently set timezone and it should something like the screenshot below.
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:
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:
This is just a snippet of possible timezone. Run it for yourself and pick the one closest to your location.
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.
and you should see something similar to the following:
As you can see the timezone has been successfully changed.
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.