Querying the current time of a city from terminal

command linetimetimezone

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

Best Answer

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'

etc.

Related Question