Timezone changes in Debian 8 and Ubuntu 16

systemctl has eased up services management. Recently I had a chance to change timezone in Debian 8 and systemctl helped me do it in just few commands as below:

 

To Check Current TimeZone

root@host:root# timedatectl
Local time: Mon 2017-04-10 12:31:27 UTC
Universal time: Mon 2017-04-10 12:31:27 UTC
RTC time: Mon 2017-04-10 12:31:27
Time zone: UTC (UTC, +0000)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

The above command will list system timezone and its current status. To make NTP synchronized to YES, we need to install ntp service by entering:

root@host:root# apt-get install ntp

root@host:root# timedatectl
Local time: Mon 2017-04-10 12:31:27 UTC
Universal time: Mon 2017-04-10 12:31:27 UTC
RTC time: Mon 2017-04-10 12:31:27
Time zone: UTC (UTC, +0000)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

Now to makeĀ NTP enabled to YES, we need to enter below command:

root@host:root# timedatectl set-ntp 1

root@host:root# timedatectl
Local time: Mon 2017-04-10 12:31:27 UTC
Universal time: Mon 2017-04-10 12:31:27 UTC
RTC time: Mon 2017-04-10 12:31:27
Time zone: UTC (UTC, +0000)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

To List all available system TimeZone:

root@host:root# timedatectl list-timezones

Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
……………………………

To Change TimeZone:

root@host:root# timedatectl set-timezone UTC

Leave a Reply

Your email address will not be published.


*