How to Set or Change the Time Zone in Linux?

Time zone is the time of any specified region followed by the people of that specific region for their commercial, social, and personal life. The time zone is different for different regions. Linux, being the leading Operating System, offers widely used timezones. The users can switch to their desired timezone whenever they want to. In this blog, methods of changing or setting the time zone in Linux have been explained by all possible methods. The content of this post is as follows:

Let’s start!

How to Display the Time Zone in Linux?

Though, when the Linux distribution is installed in the computer, the time zone is set. This time zone can be checked using the timedatectl command utility. For example, we will run the command:

$ timedatectl

Another way to find out the timezone in Linux is by using the command:

$ ls -l /etc/localtime

The time zone has been displayed in the figure.

How can the Time Zone be Set or Changed in Linux Using a Terminal?

The command line support of any Linux distribution is effective enough to perform any task. For the timezone numerous commands are discussed here to set or change the timezone.

Command 1: Set the Time Zone Using the timedatectl Command

First, we will list down all the available timezones with the timedatectl command utility by running the command:

$ timedatectl list-timezones

The timedatectl command utility can be used to set the timezone of the Linux by using the option “set-timezones”. We will select the “Africa/Abidjan” timezone:

$ timedatectl set-timezone Africa/Abidjan

Command 2: Set the Time Zone Using the tzselect Command

To use the tzselect command for changing the timezone in Linux, first navigate the “/usr/share/zoneinfo” and then execute the tzselect command. We can run both at the command at the same time by using the “&&” operator as shown below:

$ cd /usr/share/zoneinfo && tzselect

It will ask to select the continent of your country, let’s say we choose “Europe” and type “7”:

Next, it will ask you to select the country you live in. Let’s say we choose “Austria” for this type “4”. Confirm the changes by typing “1”, and the new time zone has been set:

Command 3: Reconfigure the tzdata

Another method to set the time zone is by reconfiguring the “tzdata”. If you are using the Debian-based Linux distribution, run the command:

$ sudo dpkg-reconfigure tzdata

A screen will be prompted; click on the “Ok” option:

Then choose the geo-area and press the “Ok” option:

Then it will ask you to choose the country and city in which you are living; click on the “Ok” option:

Then after selecting the country, click on “Ok”:

The time zone has been changed, as can be seen below:

$ sudo dpkg-reconfigure tzdata

The above was used for the Debian-based distributions; this can also be applied in Fedora-based Linux distributions by using the command:

$ system-config-date

For RHEL, the command will be:

$ redhat-config-date

Let’s head over to the GUI method.

How can the Timezone be Set or Changed in Linux Using a GUI?

The last method to set the time zone is by opening “Settings” from the applications menu:

Then clicking on “Date & Time” from the left corner options of the screen, and then clicking on “Time Zone”:

When the time zone is clicked, a geographic map has been opened, select the country you want to choose:

And close the map which will change the time zone:

The GUI version of various Linux distributions may vary the steps. However, you may find it easily by searching the timezone settings.

That’s all from this guide!

Conclusion

To set or change the time zone in the Linux, use the command “tzselect”, reconfiguring the timezone data (the command varies as per the Linux distribution you are using). You can also set or change the timezone by opening “Settings” of Linux. This post has briefly explained the methods to check and change the timezone in Linux.