How to change the timezone in Linux?


In this tutorial, we will discuss how to change the timezone in Linux. There are two ways to set the timezone in Linux:

  • Through CLI
  • Through GUI

Let’s discuss how to set the timezone through CLI

Set timezone through CLI

There are simple steps through which we can set the timezone. First, we should know how to check the time in Ubuntu through CLI.

To check the timezone use the following command in Ubuntu

We can use the following command to check the time in Ubuntu:

# timedatectl
Datectl Step1
Check time using the command

It will print the current timezone of your system.


Local time: Thu 2023-05-25 13:09:41 IST
Universal time: Thu 2023-05-25 07:39:41 UTC
RTC time: Thu 2023-05-25 07:39:42
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes

systemd-timesyncd.service active: yes
NTP service: active
RTC in local TZ: no

To check the current timezone using the ‘ls command’

There is also an alternative command to check the local time zone using ls command if somewhat the above command fails.

The command is as follows:

# ls -l /etc/localtime
Localtime Step2
An alternative way to check the timezone

If you only want to print the timezone like UTC or GMT, You can also do the following:

# cat /etc/timezone
Timezone Through Cat Step3
Timezone using cat command

List all the available timezones

Now, what if you want to print the list of the available timezones. For this just add “list-timezones” with “timedatectl” command.

The syntax for this is as follows:

# timedatectl list-timezones
Timezone List Step4
List of available timezones

The timedatectl is using /usr/share/zoneinfo/ directory to generate the timezone list.

Print the timezone of the particular zone

The above command will print all the available timezones. But what if you want to print the timezone of only Asian countries or of Europe. For this, we need to combine the time command with grep command. Let’s look at the example below:

# timedatectl list-timezones | grep -i "asia"
Search Through Patter Example2
Print the timezone of the particular zone

Look at another example given below:

# timedatectl list-timezones | grep -i "India"
Search Throug Pattern Step6
Print the timezone of the particular zone

Here I have used the grep command to search for the particular word. ‘|’ symbol is used to combine two commands. I hope it’s cleared.

How to Change Timezone in Linux System?

As of now, we are clear on how to check the current timezone. Let’s understand how to change the timezone. This can be done using the following command:

# sudo timedatectl set-timezone Europe/Paris 
Timezone Change Example1 1
Change the timezone- example 1

Let’s understand again from this example:

# sudo timedatectl set-timezone Africa/Monrovia
Timezone Change Example2
Change the timezone – example 2

Confirm the timezone using timezonectl command as shown above.

Change the Timezone in Linux Using tzdata Command

There is another way to change the timezone in Linux using tzdata. Let’s understand by the following example:

First, you need to figure out the timezone you want to configure. Next, save the timezone using the following command in /etc/timezone.

# echo "Europe/Paris" | sudo tee /etc/timezone
Echo Timezone Step 5
Save the timezone

Here, we have used tee command which is used to capture the intermediate output and writes it content to standard output. Use the following command to change the timezone:

# sudo dpkg-reconfigure --frontend noninteractive tzdata
Dpkg Timezone Step7
Change the timezone

It will print the current timezone. I hope it’s clear.

Using Symlink to change the time zone

Using ‘timedatectl’ command is the most ideal way to deal with time zone settings however if your system does not have the timedatectl command available, we will have to create a symlink.

Identify the correct time zone file in /usr/share/zoneinfo. Time zone files are organized by region and city, for example, /usr/share/zoneinfo/America/New_York or /usr/share/zoneinfo/Europe/Paris.

Remove the previous symbolic link from /etc/localtime by running the following command:

sudo rm -rf /etc/localtime

Create a symbolic link from the correct time zone file to /etc/localtime. Replace Region/City with the appropriate time zone information:

sudo ln -s /usr/share/zoneinfo/Region/City /etc/localtime

For example, to set the time zone to Europe/Brussels, run:

sudo ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime

Verify the change by running the ‘date‘ command from the terminal. The output will show the current time and time zone.

Running Date Command
Running Date Command

Change the timezone in Ubuntu using GUI

Earlier we discussed how to change the timezone in Linux using CLI. Let’s understand how to change the timezone using GUI in Ubuntu.

1. Open the settings

Select the settings either by clicking on activities or by direct shortcut as shown in the figure below:

GUI Step 1
Open the settings

2. Select Date and Time Tab

A new window will open where you need to select the date and time tab. Further, turn the Automatic Time Zone to off and on the Time zone box to change the timezone as shown in the figure given below:

GUI Select Date And Time
Select the Timezone

3. Set the timezone

On clicking the timezone box option, it will be redirected to a new window as shown in the figure given below:

GUI Set Timezone Step3
Set the Timezone

Here, you need to set the timezone.


That’s it. You can now set the timezone using either GUI or CLI as described in the above steps. If facing any issues then do let us know in the comment section. If you need to check details about any of the commands discussed in this tutorial, go ahead and use the man command in Linux to learn more about the commands.