从终端查询城市当前时间

ste*_*erz 5 command-line time timezone

我的朋友遍布全球,在给他们打电话之前,我需要知道他们当前的时间。Linux 中是否有可以在终端中查询城市(如果存在)的应用程序(类似这样):time miami

PS:是的,我知道我可以从 Google 查询,但我更喜欢使用终端

bsd*_*bsd 10

date命令将根据您的语言环境为您提供当前日期/时间。
您可以通过在命令前加上不同的时区来更改它,仅一次

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
Run Code Online (Sandbox Code Playgroud)

然后为了简化访问,只需在 .bashrc 文件中创建别名,例如。

alias dad='TZ=Paris date'
alias fred='TZ=Amsterdam date'
Run Code Online (Sandbox Code Playgroud)

等等。