Linux Timezone Tutorial (timedatectl and Locale)
This tutorial shows how to set the system timezone—and optionally the locale—with xyz.sh/timezone (aliases tz, locale).
$ curl -fsSL xyz.sh/timezone | bash
Details · xyz.sh/timezone · Last updated:
Commands
List zones (read-only, root not required): curl -fsSL xyz.sh/timezone | bash -s -- --list
Set a timezone: curl -fsSL xyz.sh/timezone | bash -s -- Asia/Shanghai
Also set a locale: curl -fsSL xyz.sh/timezone | bash -s -- Asia/Taipei zh_TW.UTF-8
With no arguments and a TTY, the script prompts. When piped to bash without a TTY, a timezone argument is required.
timedatectl is preferred, with /etc/localtime as a fallback. Locales use locale-gen / update-locale on Debian and localectl on RHEL-like systems, installing glibc-langpack when needed.
How to change it back
There is no separate uninstall command. Use the same script to set the timezone you want, for example bash -s -- UTC, optionally with the previous locale.