Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to set time, timezone and date in Linux

📅 2021-Feb-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ date, time, timezone ⬩ 📚 Archive

Time and date are usually set correctly on my Linux systems, but the timezone is set to UTC.

Set timezone

We can use the timedatectl tool that ships with systemd to set the timezone.

$ timedatectl list-timezones
$ sudo timedatectl set-timezone "America/Los_Angeles"

Note that the service that generates /var/log/syslog will continue to use your earlier timezone, until you restart it or restart the computer. Restart its service to make it start using your new timezone for its newer log entries:

$ sudo service rsyslog restart

Tried with: systemd 245 and Ubuntu 20.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email