Change timezone in Raspberry PI OS Lite from terminal

Last Updated on

One of main actions after installing your Raspberry PI OS regards configuring timezone, to show correct time in your system.

This guide will help you in performing this setting from terminal. This guide applies both to Raspberry PI OS Lite installation and Raspberry PI OS Desktop installation.

Setup Timezone

Raspberry PI OS, like Debian, includes timezone files in the /usr/share/zoneinfo directory tree, which is provided by the tzdata package.

Looking at this directory:

pi@raspberrypi:~ $ cd /usr/share/zoneinfo/
pi@raspberrypi:/usr/share/zoneinfo $ ls
Africa Brazil Egypt GB Hongkong Jamaica Mexico Poland ROC US
America Canada Eire GB-Eire HST Japan MST Portugal ROK UTC
Antarctica CET EST GMT Iceland Kwajalein MST7MDT posix Singapore WET
Arctic Chile EST5EDT GMT+0 Indian leap-seconds.list Navajo posixrules SystemV W-SU
Asia CST6CDT Etc GMT-0 Iran Libya NZ PRC Turkey zone1970.tab
Atlantic Cuba Europe GMT0 iso3166.tab localtime NZ-CHAT PST8PDT UCT zone.tab
Australia EET Factory Greenwich Israel MET Pacific right Universal Zulu

To check current local time, please you can verify what timezone file is pointed by /etc/localtime link:

pi@raspberrypi:~ $ ls -l /etc/localtime
lrwxrwxrwx 1 root root 33 Jun 20 15:41 /etc/localtime -> /usr/share/zoneinfo/Europe/London

To change local time, you can use the convenient tzdata. From terminal, type command:

sudo dpkg-reconfigure tzdata

This command will enable Configuring tzdata wizard:

RPI configuring tzdata geographic area

Please select your geographic area and press ENTER key.

RPI configuring tzdata time zone

Please select your time zone (Rome in my case) and press ENTER. Wizard will exit and your new config will be confirmed in following terminal message:

pi@raspberrypi:~ $ sudo dpkg-reconfigure tzdata

Current default time zone: 'Europe/Rome'
Local time is now: Sat Jun 20 17:19:49 CEST 2020.
Universal Time is now: Sat Jun 20 15:19:49 UTC 2020.

New configuration will be also confirmed from /etc/localtime link:

pi@raspberrypi:~ $ ls -l /etc/localtime
lrwxrwxrwx 1 root root 31 Jun 20 17:19 /etc/localtime -> /usr/share/zoneinfo/Europe/Rome

Same wizard can also be found with raspi-config (run with sudo) -> Localisation Options -> Change Time Zone.

Enjoy!

Check hardware prices with following links:

Amazon raspberry pi boards box
Amazon raspberry pi Zero W box
Amazon Micro SD box