Listing, updating and changing the system timezone in Linux servers are important operations mostly when dealing with scheduling tasks, cronjobs. In today’s post-VPS age, timezones shouldn’t be confused with the cloud regions. Bold statement but, virtualized Linux kernels don’t care in which cloud regions they are being deployed. With that said, here are some commands that could help you list and update timezones in Linux virtual machines.
Prerequisites
- Linux
Solution
Multiple ways to get the current timezone:
cat /etc/timezone
timedatectl
ls -l /etc/localtime
date
Check available timezones:
timedatectl list-timezones
Finally, pick the timezone of your choice or decision, and update it. For instance:
timedatectl set-timezone Europe/Copenhagen
or, if you need a more interactive way, run:
tzselect
Conclusion
Of course, there are other alternative ways to update the timezone such as using the GUI, or symlinks, but in my book, these are not efficient enough.
If you have any other great solutions on this topic, or even issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.