Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have friends all over the globe and before calling them I need to know their current time. Is there an application in Linux where one can query a city (if exists) in terminal (something like this): time miami

P.S: Yes I know that I can query it from Google but I prefer using the terminal

share|improve this question
up vote 10 down vote accepted

The date command will give you the current date/time based on your locale.
You can change that, one time only, by prefixing the command with a different timezone

TZ=CST6CDT date # Will print the current time in the USA Central time
TZ=Chicago date # will do the same, iff Chicago is listed by name in the /usr/share/zoneinfo/ dir hierarchy

Then to simplify ease of access, just create aliases in you .bashrc file, eg.

alias dad='TZ=Paris date'
alias fred='TZ=Amsterdam date'


share|improve this answer
very nice answer, thanks. let's say i want miami (not listed under /usr/share/zoneinfo/) and how do i find out its zone code (CST6...)? – sterz Mar 8 '12 at 18:54
You could use google maps or earth, but in this case I'll just tell you. Miami is in the Eastern Time zone, EST5EDT, same as New_York (Miami's just a little further south). Quick G search, found and like this, gives TZ – bsd Mar 8 '12 at 19:26
“in the /usr/share/zoneinfo hierarchy”? I've never seen that. AFAIK you need the full path from the zoneinfo directory, e.g. TZ=America/Chicago or TZ=Europe/Paris or TZ=Hongkong. – Gilles Mar 8 '12 at 23:18
Nope, just the City is enough, again I speak empirically. I tried it, and it works. I'm in America but the TZ=Paris worked fine. If I were going to rely on this, personally I'd stick with the EST5DST form. – bsd Mar 8 '12 at 23:26
Seems Gilles is right. It works for me only with full path. – manatwork Mar 9 '12 at 8:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.