DEV Community

Amruta Pardeshi
Amruta Pardeshi

Posted on

Change the timezone on ubuntu linux server

First check which timezone the server is using
>>ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Sep 2 07:09 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC

>>timedatectl
Local time: Thu 2022-10-13 12:18:02 UTC
Universal time: Thu 2022-10-13 12:18:02 UTC
RTC time: Thu 2022-10-13 12:18:03

Time zone: Etc/UTC (UTC, +0000)

System clock synchronized: yes

NTP service: active

RTC in local TZ: no

Find out which time zone you have to set.
This command will give you list of timezones

>>timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre

Now set the timezone
>>sudo timedatectl set-timezone Asia/Kolkata

Now check if it is set correctly
>>timedatectl
Local time: Thu 2022-10-13 17:51:00 IST
Universal time: Thu 2022-10-13 12:21:00 UTC
RTC time: Thu 2022-10-13 12:21:01

Time zone: Asia/Kolkata (IST, +0530)

System clock synchronized: yes

NTP service: active

RTC in local TZ: no

Doneee ...

Top comments (0)