You can change Linux Timezone via bash command line easily.
- All Timezone information are stored in /usr/share/zoneinfo/.
- /etc/localtime is symlink to Timezone file stored in /usr/share/zoneinfo/.
Display Current Timezone
When you run the command below, you see which timezone file linked to the localtime symlink.
ls -l /etc/localtime
Alternative Method
[root@rhel75 ~]# timedatectl | grep -i 'time zone' Time zone: Europe/Istanbul (+03, +0300)
Change Linux Timezone
When you run commands below respectively, active timezone on run-time has been changed. Also let’s copy current localtime file as backup plan.
# mv /etc/localtime /etc/localtime.yedek # ln -s /usr/share/zoneinfo/Europe/Istanbul /etc/localtime
For permanent change, we need to do the same change on /etc/sysconfig/clock file.
# cat /etc/sysconfig/clock ZONE="Europe/Istanbul" UTC=true ARC=false
Alternative Method
You can use timedatectl utility to display current timezone information as an alternative to the symlink method.
[root@rhel75 ~]# timedatectl set-timezone Europe/Istanbul
You can reach out the full list of timezone information using link below;
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Leave a Reply