VPS

How to Change Timezone in Ubuntu?

A functional server on a public or private network provides many different services. Therefore, this server has to be properly configured to do it efficiently. System configurations range from very complex and technical like resource management, to simpler things like time and date configuration. In this tutorial, we’ll do exactly that – how to change timezones in Ubuntu.

While the correct timezone may be especially important in transactional IT systems where transparency is vital during audit processes, on a different kind of system knowing how to change timezone on Ubuntu based VPS will ensure correct and comprehensive logging.

If you’re running a CentOS 7 system, you can learn how to change timezone in CentOS on our article covering that!

Change Timezone in Ubuntu – Two Methods

Correctly setting the timezone of our Linux server is an important step in its configuration. An improperly set timezone will primarily impact three things – logging, automation, and cronjobs.

Many sysadmins use tools to automate the deployment and updating of applications. A badly configured time would keep the application from deploying at the right time. At the same way, the scheduling of backups and administrative tasks could be affected as well.

Another point to keep in mind is that, if the server uses NTP then this error could be multiplied in the various nodes of the network. So as we can see, it is something to take seriously. Learning how to change timezone in Ubuntu might be a small fundamental, but can impact your system.

Before we make any modifications, first, we need to connect to our server using SSH. If you’re having trouble, check out our PuTTY tutorial.

There are several ways to change timezone in Ubuntu. In this post, we will use tzselect and timedatectl.

How to Change Timezone in Ubuntu Using tzselect

In Debian-based distributions such as Ubuntu, Linux Mint or ElementaryOS, it is possible to use the tzselect command. It is a Linux command that allows us to change the timezone with a command line interface.

For it, in a terminal we run the following command:

sudo tzselect

When running the command, the terminal will show us a list of geographical areas that we have to select according to our needs. For example, if we select America, we can see the list of available timezones for that region. Once the command is entered, just enter in the numerical value displayed next to each region.

Once you’re done, you can check if the change was sucessful by entering the following command into the command line:

timedatectl

And with that, we have changed the timezone.

Change Timezone in Ubuntu Using timedatectl

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

First, let’s see what timezones are available.

timedatectl list-timezones

As we can see there are many zones available. To exit this display you can hit CTRL+C. However, we can combine the above command with a grep command to filter the search using the name of a city as a criteria. For example:

timedatectl list-timezones | grep Caracas

Once we know which timezone to select, we need to use the following command to make the change:

sudo timedatectl set-timezone [timezone]

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

timedatectl

Conclusion

Knowing how to change the timezone in Ubuntu is a simple but important task to maintain the correct server configuration. This becomes even more important if the server uses NTP to synchronize the time of the network devices. In addition, remember that a bad configuration of timezones can lead to problems while programming backups and other automatized tasks.

In this tutorial, we have learned how to change timezones in Ubuntu using two methods – tzselect and timedatectl.

We recommend that you continue reading about these commands and consult their documentation to continue increasing your knowledge about them.

About the author

Edward S.

Edward is Hostinger's copywriter. He's an expert communicator with years of experience in IT as a writer, marketer, and Linux enthusiast. IT is a core pillar of his life, personal and professional. Edward's goal is to encourage millions to achieve an impactful online presence. He also really loves dogs, guitars, and everything related to space.

Add Comment

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Exclusive Content

Join thousands of webmasters who get our free newsletter with tips on how to drive more traffic and revenue to their websites!

Please wait...

Thank you for sign up!

More in VPS
How to Use Sudo and the Sudoers File
Close