blog posts

How to Change Time Zone in Ubuntu?

An application server provides various services in a public or private network. Therefore, this server must be properly configured to do this efficiently. System configurations range from complex and technical tasks such as resource management to simpler ones such as time and date configuration. In this tutorial, we will do exactly that, how to change timezones in Ubuntu

Although the correct time zone is especially important in transactional IT systems where transparency during audit processes is very important, but in a different type of system we know how to change the time zone on an Ubuntu-based VPS. It guarantees correctness and comprehensiveness.

Changing time zone in Ubuntu – two methods

Correctly setting the time zone of our Linux server is an important step in its configuration. An incorrectly set timezone primarily affects three things – logging, automation, and cron jobs.

Many sysadmins use tools to automate and update applications. An improperly configured time will cause the application to not deploy at the correct time. Likewise, the backup schedule and run jobs can also be affected.

Another thing to keep in mind is that, if the server uses NTP, this error can be propagated to different network nodes. So as we can see, this is something you should take seriously. Learning how to change the time zone in Ubuntu may be basic, but it can affect your system.

There are several ways to change the time zone in Ubuntu. In this post we will use tzselect and timedatectl.

How to change time zone in Ubuntu using tzselect

In Debian-based distributions such as Ubuntu, Linux Mint, or ElementaryOS, the tzselect command can be used. This is a Linux command that allows us to change the time zone with a command line interface.

For that, we run the following command in the terminal:

sudo tzselect

 


When running the command, the terminal will show us a list of geographic regions that we should choose according to our needs. For example, if we choose America, we can see the list of available time zones for that region. After entering the command, just enter the numerical value displayed next to each field.

After you’re done, you can check if the change was successful by entering the following command at the command line:

timedatectl

 

And with that, we’ve changed the time zone.

How to change time zone in Ubuntu using timedatectl

The next command that allows us to change the time zone in Ubuntu is timedatectl. This command is more complete than the previous command as it also allows to change other things like system date and time.

First, let’s see what time zone is available.

timedatectl list-timezones

 

As we can see there are many areas available. You can press CTRL + C to exit this screen. However, we can combine the above command with a grep command to filter the search using a city name as criteria. For example :

timedatectl list-timezones | grep Caracas

Once we know which time zone to choose, we need to use the following command to make the change:

sudo timedatectl set-timezone [timezone]

Finally, using the following command, you can see the applied change:

timedatectl