How to change timezone on Linux

Question: I want to change the default timezone on my Linux system. How can I change timezone on Linux?

To change the default timezone, the first step is to select the timezone of your region among available timezones. For that, you can use tzselect command which allows you to view and choose installed timezone files.

$ tzselect

Go through the timezone selection menu to identify your zone.

tzselect will display your timezone in Posix TZ format (e.g., "America/New_York"). Make a note of this value, and proceed next.

Change Timezone on Per-User Basis

If you want to change timezone for a specific user only, you can define TZ environment variable in ~/.bashrc as follows.

export TZ='America/New_York'

Then re-login or execute ~/.bashrc to activate the change.

$ source ~/.bashrc

Change Timezone System-wide

To change timezone on Linux system-wide, use the following commands.

$ sudo rm -f /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Note that the path to the timezone file is constructed from the TZ variable you obtained earlier.

The system-wide timezone can be overridden by TZ environment variable.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

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