What's the best approach for configuring the Time Zone non-interactively?

Previously for hostname, I've used

sudo raspi-config nonint do_hostname

However, I am unable to locate the equivalent command for timezone?

  • 1
    man timedatectl Commented Jul 19, 2018 at 3:33
  • 2
    @JaromandaX make it an answer. Your tiny comment may be overseen (like by me).
    – Ingo
    Commented Jul 19, 2018 at 10:58
  • @JaromandaX - frustrating, but not a waste of time (at least not for the community) your answer has 12 votes and it's being found be people who appreciate it. I'm sorry that it hasn't been picked up as the right / best answer.
    – dlu
    Commented May 5, 2020 at 18:32
  • 1
    @dlu - it's not really a big deal :p Commented May 5, 2020 at 22:35

2 Answers 2


use timedatectl - for example

sudo timedatectl set-timezone Australia/Sydney

The time zone is set by a symbolic link from /etc/localtime to a file in the /usr/share/zoneinfo directory.

The time zone needs to be in the form 'Area/Location' where these conform to the standards used in Linux. E.g. for Area use Africa, America, Antarctica, Arctic, Asia, Atlantic, Australia, Europe, Indian, and Pacific.

For Location use the name of a specific location within the Area. This is usually a city or small island.

See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for details

For example for New Zealand use Pacific/Auckland

  • First you need to remove /etc/localtime, otherwise /etc/timezone will be overwritten.
  • Then create your link
  • Then remove /etc/timezone

The commands I run are;

sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
sudo rm /etc/timezone

Edit: Now I'm looking at it I don't exactly know why I'm removing /etc/timezone. Eeek!

  • 2
    This answer explains how time zones are (currently) implemented, however, the "right" answer is @JaromandaX's answer below. Use timedatectl, abstractions are your friend.
    – dlu
    Commented May 5, 2020 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.