Skip to content
Home » How to Change the Timezone on the Linux Server?

How to Change the Timezone on the Linux Server?

  • by

When you install Linux on a server for the first time, you are asked to select the regional zone where the server is located so that Linux will create the date and the time on the server based on that zone. But sometimes you want to change the timezone on your Linux server.

 

Problem

How to change the timezone on the Linux server?

 

Solution

To see the timezone currently used on the server, you can use the command:

timedatectl
The timedatectl command

 

From the image above, the server’s time zone is in the American region in the New York area. To see the timezone provided by Linux, use the following command:

timedatectl list-timezones
List of timezones

 

If you want to change the timezone to Singapore, then you can type the command below:

timedatectl set-timezone Asia/Singapore

 

Then the time on the server will change to Singapore time, as in the image below:

After updating the timezone

 

Note

Apart from using the timedatectl command, you can also use the command below:

tzselect

 

There is a list of the continents. Select the number that corresponds to the zone you want. For example, I choose Singapore as the timezone on my server, then I will choose number 5 for Asia, and will choose Singapore in the country selection, as in the image below:

Alternative to change the timezones

 

Once finished, the script in the red box must be inserted into the .profile or .bashrc file (if there is no .bashrc file on the server, then create the file manually). After that, use the command:

source ~/.bashrc

 

Then the timezone on the server will change.

 

References

linuxize.com
wikihow.com
baeldung.com
askubuntu.com
superuser.com

image_pdfimage_print
Visited 17 times, 1 visit(s) today
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *