Categories
Linux

Changing TimeZone in RHEL 6/7/8 and Centos

First, check the current timezone in your system by using the date command.

[root@technix~]# date
Thu Oct 29 11:28:27 PST 2020

Here the timezone is set to PST.

Change Timezone in Centos/RHEL 7/8

We can use the timedatectl command to change the current timezone. First, let’s list all timezones.

[root@technix ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
.....

Now use the following command to change the timezone to

[root@technix ~]# timedatectl set-timezone Asia/Kolkata

Change Timezone in Centos/RHEL 5/6

To change timezone in Centos/RHEL 5/6 versions we just need to link /etc/localtime file to the correct timezone configuration file.

[root@technix ~]# mv /etc/localtime /root/localtime.bak
[root@technix ~]# ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime

With this timezone will be changed and can be verified by issue date command