When logging in to remote machine X, by default, date will give the time in the local timezone:

$ date
Mon Nov 17 22:45:47 CET 2014

Note that TZ is not set:

$ export | grep TZ

So, I set TZ to my own local timezone for every machine I'm on:

$ export TZ=/usr/share/zoneinfo/Canada/Eastern
$ date
Mon Nov 17 16:46:13 EST 2014

The question is, once I have this set, how do I get the time for the system default timezone, i.e. the timezone that applies if I, as a user, do not manually set TZ? Unsetting TZ gives me the UTC time, which is not what I seek:

$ TZ= date
Mon Nov 17 21:47:13 UTC 2014

Interestingly, TZ= date gives UTC time, even when I didn't yet set TZ to anything; yet when I didn`t yet set TZ to anything, a simple date gave the date in the system default timezone...

2 Answers 2


Try unsetting the TZ variable (which is different from setting it to ""):

$ (date; export TZ=/usr/share/zoneinfo/Canada/Eastern; date; unset TZ; date)
Tue Nov 18 03:25:25 IST 2014
Mon Nov 17 16:55:25 EST 2014
Tue Nov 18 03:25:25 IST 2014

Note how I tried it in a subshell, so that my current shell remains unaffected.

  • Interesting. I was not aware that unsetting is different from setting it to empty.
    – gerrit
    Commented Nov 17, 2014 at 22:23
  • @gerrit Usually in scripts there's not much difference. But for a few variables which control the behaviour of programs, like TZ, POSIXLY_CORRECT, HISTTIMEFORMAT, it does matter.
    – muru
    Commented Nov 17, 2014 at 22:29

You should be able to view the system clock time zone by catting this file: /etc/sysconfig/clock.

  • This is a good article on the subject.
    – bitcycle
    Commented Nov 17, 2014 at 21:55
  • Is this distribution-specific? I don't have /etc/sysconfig on my Debian servers.
    – Barmar
    Commented Nov 17, 2014 at 22:25
  • @Barmar /etc/sysconfig is a Red Hat thing. Commented Nov 18, 2014 at 9:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .