Why standardize time zone ?

Hi all, today we shall see how to manage time zone in Linux machines. Have you ever wondered why it is really important to standardize the time zone in servers? Time zone plays vital role in the system like troubleshooting something with help of logs, for scheduling operations using cron, synchronize data between applications among clusters, and so on..

Workaround #1

In this method, we are going to unlink (or) remove the local time from the system and link required time zone to the system. Lets see how to change the timezone from UTC to IST below.

First remove (or) unlink the localtime file available under /etc

# rm /etc/localtime


# unlink /etc/localtime

Then link the required time zone file from zoneinfo

# ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

That’s it 😀 Sometimes this method doesn’t work for some of the Linux flavours. Lets see how to resolve it using below workaround 😉

Workaround #2

To make this possible, update the required timezone in timezone file (optional) as shown below. Also make sure that tzdata package is up-to-date in your machine.

# cat /etc/timezone

Next, export TZ value with required timezone value from the terminal.

# export TZ=Asia/Kolkata

Last step is to make this time zone default during system boot, add (or) modify export TZ line in profile file. — This is only applicable only if you’re following the workaround #2.

# grep "export TZ=" /etc/profile

export TZ=Asia/Kolkata

That’s it 😀 So whenever the system boots, it fetches the timezone details from the timezone & profile file.

Workaround #3

If above steps doesn’t help you and you’re using Ubuntu (or) Debian distro, then you can simply update tzdata package and reconfigure it

# dpkg-reconfigure tzdata

Still got confused in setting up default timezone in your linux machine? Feel free to ask us through comment section, we will reply at the earliest possible 🙂

❤️ Sharing is caring ❤️

Notify of
Inline Feedbacks
View all comments