For operating systems having the correct time zone is required for system tasks and processes and down to the minor parts such as logs by your applications. Having incorrect information can impact systems when setting up automatic jobs such as cron jobs that rely on the system’s timezone to execute.
For Ubuntu server users, the time zone by default is not set. However, desktop users with an active Internet connection may automatically set up this. If not, it can be set up in two different ways.
In the following tutorial, you will know how to configure Timezone on Ubuntu 22.04 LTS Jammy Jellyfish using the GUI and terminal methods.
Table of Contents
Timezone Using Terminal
Checking the Current Timezone
First, check to see the current time zone in your Ubuntu Terminal (CTRL+ALT+T) by typing the following command.
The timezone, by default, is configured with a (symlink) from (/etc/localtime) to a binary timezone identifier in the (/usr/share/zoneinfo) directory, which you can view the current system timezone information by finding the file where the symlink directs to by typing the following command:
ls -l /etc/localtime
Another way is to use the (cat) command to print the time from the (/etc/timezone) file by typing the command:
Changing the Timezone with (timedatectl) Command
Next, you can change the timezone settings in the Ubuntu terminal. First, you will need to find the region and city format using the (timedatectl) command to print this list in (Region/City) Format.
Now you will find a long list of region/city names, use your (up) and (down) keyboard arrow keys to navigate until you find the timezone you are after.
Once you find the correct entry, you will use (timedatectl) to set the timezone with the following command:
sudo timedatectl set-timezone your_time_zone
The tutorial will set (Australia/Queensland) using the example command below.
sudo timedatectl set-timezone Australia/Queensland
Next, check if the timezone has been applied by re-entering the (timedatectl) command.
As mentioned above, my localtime was AWST (Australian Western Time); now, it is AEST (Australian Eastern Time).
Timezone Using the GUI
Ubuntu desktop users have a secondary choice to change the timezone settings instead of using the terminal option. Using the GUI instead, this is done quicker and easier for new users of Ubuntu.
First, open the system settings, which the quickest way is by clicking in the top right-hand corner of your Ubuntu desktop screen as shown below and clicking on (settings).
Next, on the left-hand side, scroll down until you find the (Date & Time) tab and left-click on it to show the timezone settings in the right-hand GUI window.
This should be automatically set by default if your operating system is connected to the Internet for desktop users.
To select the new timezone, click on the (Time Zone) on the right-hand side, currently were (AEST (Brisbane, Australia) is in our above picture. You will then see a new pop-up with a map. Here, you use the left click of a mouse button to select your location, automatically changing your time zone on the map.
The example below is from switching to (AWST (Perth, Australia) from (AEST (Brisbane, Australia) from the terminal timezone example that was listed area to correct my time zone.
Once you have selected the correct timezone, click on the (X) in the top right-hand corner to apply.
Comments and Conclusion
In the tutorial, you have learned to set your timezone using the terminal and use the GUI if you have a desktop or headless server on Ubuntu 22.04 LTS Jammy Jellyfish. Overall, I would suggest that novice and new users try the terminal command as it will be more entertaining to learn a new system command than using the default GUI.