Thursday, 16 May 2019

Change TimeZone in linux

Standard and precise timezone is crucial for the evaluation and execution of many tasks and processes running on a Linux instance. we come across certain circumstances where we need of changing and setting up the different timezone on the Linux system.
Let’s see how can we do it.

Check Current TimeZone :

We can do using date command
date
Thu May 16 10:35:11 IST 2019


or
using timedatectl command
timedatectl 
 Local time: Thu 2019–05–16 23:05:55 IST
 Universal time: Thu 2019–05–16 17:35:55 UTC
 RTC time: Thu 2019–05–16 17:35:55
 Time zone: Asia/Kolkata (IST, +0530)
 System clock synchronized: yes
 systemd-timesyncd.service active: yes
 RTC in local TZ: no


How to change:

  • All the time zones are located under /usr/share/zoneinfo directory


  • Now create a link the timezone file from the above directory to the /etc/localtime directory
ln -s /usr/share/zoneinfo/US/CET /etc/localtime
  • In some of the distributions, the timezone is controlled by /etc/timezonefile.
cat /etc/timezone 
Asia/Kolkata
  • To change this to Australia time (Brisbane), modify the /etc/timezone file as shown below.
# vim /etc/timezone
America/Brisbane
That’s it.
Happy Learning.

No comments:

Post a Comment

Generating Unique Id in Distributed Environment in high Scale:

Recently I was working on a project which requires unique id in a distributed environment which we used as a  primary  key to store in dat...