{"id":822,"date":"2026-10-27T11:12:45","date_gmt":"2026-10-27T03:12:45","guid":{"rendered":"https:\/\/play.datalude.com\/blog\/?p=822"},"modified":"2026-10-27T11:12:46","modified_gmt":"2026-10-27T03:12:46","slug":"bash-alias-trick-show-multiple-timezones","status":"publish","type":"post","link":"https:\/\/play.datalude.com\/blog\/2026\/10\/bash-alias-trick-show-multiple-timezones\/","title":{"rendered":"Bash alias trick: show multiple timezones"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Just a dumb trick I whipped up and was inordinately proud of. Sure I could go along to timeanddate dot com but I spend a lot of my time in my terminal and this is immediate. Small effort big payback. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">OK, so the code is just this, added to .bashrc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tztime() {\n  for tz_name in \"$@\"; do\n    printf \"    In %-15s its %s\\n\" \"$tz_name\" \"$(TZ=$tz_name date +'%H:%M:%S %Z')\"\n  done\n}\nalias teamtime='tztime America\/Chicago UTC Europe\/London Asia\/Manila Asia\/Tokyo'\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first block is the function that does all the work, formatting the dates nicely. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>for tz_name in \"$@\"; do<\/code> loops over all arguments supplied as space-separated array.<\/li>\n\n\n\n<li><code>TZ=$tz_name <code>date +'%H:%M:%S %Z<\/code> <\/code>sets the <code>TZ<\/code> environment variable and then runs date with the specified format. (TZ in your shell remains unchanged)<\/li>\n\n\n\n<li><code>%-15s<\/code> prints the time-zone name left-aligned in a field at least 15 characters wide. This was just to get them to align nicely<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The alias is whatever you want to call it, and is basically a space separated list of timezones you want to look at. Edit away. Output:<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>teamtime\n    In America\/Chicago its 22:03:13 CDT\n    In UTC             its 03:03:13 UTC\n    In Europe\/London   its 03:03:13 GMT\n    In Asia\/Manila     its 11:03:13 PST\n    In Asia\/Tokyo      its 12:03:13 JST\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Just a dumb trick I whipped up and was inordinately proud of. Sure I could go along to timeanddate dot com but I spend a lot of my time in my terminal and this is immediate. Small effort big payback. OK, so the code is just this, added to .bashrc The first block is the &#8230; <a title=\"Bash alias trick: show multiple timezones\" class=\"read-more\" href=\"https:\/\/play.datalude.com\/blog\/2026\/10\/bash-alias-trick-show-multiple-timezones\/\" aria-label=\"Read more about Bash alias trick: show multiple timezones\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[144,4],"tags":[],"class_list":["post-822","post","type-post","status-publish","format-standard","hentry","category-bash-script","category-linux"],"_links":{"self":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/comments?post=822"}],"version-history":[{"count":1,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/822\/revisions"}],"predecessor-version":[{"id":823,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/822\/revisions\/823"}],"wp:attachment":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/media?parent=822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/categories?post=822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/tags?post=822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}