How to check which timezone in Linux?

Usually, the TZ environment variable will tell you something useful. However, it is best to use functions such as mktime() and localtime() to convert between time_t and a local timezone representation. That is, don't try to do the conversion yourself.


If you mean from the console, just type:

date +%Z

If you want the numeric timezone:

date +'%:z %Z'

Sample output:

-05:00 EST

I wanted to find the timezone in "US/Eastern" or "Europe/London" form instead. You can find this in:

  • /etc/timezone (present on Ubuntu and Red Hat? but not e.g. Amazon Linux)
  • (on Red Hat style systems) as ZONE="US/Eastern" in /etc/sysconfig/clock
  • or you can try and match /etc/localtime to one of the files under /usr/share/zoneinfo; annoyingly this doesn't seem to be a symlink, but you can e.g.

    cd /usr/share/zoneinfo
    find * -type f -exec sh -c "diff -q /etc/localtime '{}' > /dev/null && echo {}" \;

    to find matching files - there's probably better ways to do that, but that works. There will be multiple matches.