Linux / UNIX: Set The Time Zone On a Per User Basis

We are developing Linux based application and we would like to set the time zone on a per user basis for individual user. How do I configure Fedora Linux or any Unix like oses to set the time zone on a per user basis using bash shell?

A time zone is a region of the Earth that has adopted the same standard time, usually referred to as the local time. Most adjacent time zones are exactly one hour apart, and by convention compute their local time as an offset from Greenwich Mean Time.

You can set the time zone system-wide using this method. However use following instructions to set the time zone on a per user basis.

Most Unix based systems, including Linux and Mac OS X, keep system time as UTC. Rather than having a single timezone set for the whole computer, timezone offsets can vary for different processes. Standard library routines are used to calculate the local time based on the current timezone, normally supplied to processes through the TZ environment variable. This allows users in multiple timezones to use the same computer, with their respective local times displayed correctly to each user. Timezone information is most commonly stored in a timezone database known as zoneinfo

Procedure – set the time zone on a per user basis

Open user ~/.bashrc or ~/.bash_profile file using a text editor such as and set up TZ environment variable. Append or SET TZ as follows:

export TZ="/usr/share/zoneinfo/{TIMEZONE-DIRECTORY}/{TIMEZONE_FILE}"

If your username is vivek and you would like to set TZ to Asia/Calcutta (INDIA IST) type the following command:
$ vi /home/vivek/.bashrc
$ vi ~/.bashrc
Append the following line:
export TZ="/usr/share/zoneinfo/Asia/Calcutta"
Save and close the file. You can type the same command at bash shell prompt too:

export TZ="/usr/share/zoneinfo/Asia/Calcutta"

See also:

  • Set the time zone system-wide using this /etc/localtime file
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • Rai Apr 3, 2008 @ 8:16

    The above steps don’t seem to work well.

    Please check the link

    [root@ rai]# cat timecheck.php

    echo “Present time in (India IST) is : “.date(“d D, M Y – h:i:s A”).””;
    [root@ rai]# ll .bash
    .bash_profile .bashrc

    [root@ rai]# cat .bash*
    export TZ=”/usr/share/zoneinfo/Asia/Calcutta”
    export TZ=”/usr/share/zoneinfo/Asia/Calcutta”

    Please check the correct time comparisons from :


    Use php :

    echo “Present time in (India IST) is : “.date(“d D, M Y – h:i:s A”).””;

    I’d appreciate if you let me know what was wrong. :-)


  • Vasudeva Apr 3, 2008 @ 14:04

    Awesome Vivek. It works fine for me.

  • cbt May 7, 2010 @ 16:27

    If I set TZ for my user, will my user’s crontab run at my new timezone, or the system timezone?

  • Tamara Nov 18, 2014 @ 19:21

    Worked perfectly. I was trying to get my user time to match server time. Perfect, thanks!!!

  • Pradeep Jun 17, 2015 @ 20:30

    works for me too.
    [xxxxx@xxxxx xxxxx]$ export TZ=”/usr/share/zoneinfo/Europe/Paris”

    Thanks a lot.

Leave a Reply

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

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.