How to change time zone in linux centos ( date time)

Change timezone in Linux ( centos) :

 

Step 1: Check your current date time
This step is not needed but its helpful to know what time you have currently.

$ date

 

Step 2:  Make backup copy of your current timezone file for safety:

$ cp /etc/localtime /etc/localtime-backup

Step 3: Go to timezone folder and find correct time zone file. Let set the timezone to Newyork  for this example.

$ cd /usr/share/zoneinfo

Look for country America ( It will be a folder):

$ cd /usr/share/zoneinfo/America

you will find the file call New_york which is timezone file for new york . Now copy that file to local time.

$ cp /usr/share/zoneinfo/America/New_york  /etc/localtime

Step 4: Your time zone is now set. You can check by typing date command to see new date time information.

 

Note: Many server prefer to setup UTC time which can be set with same method as mentioned above. UTC date time file is located in

/usr/share/zoneinfo/UTC.

 

Synchronization of Date time:

Date time is synchronize by NTP module of Linux, which is generally installed in all Linux distribution but if it is missing then it can be install by yum.

$ yum install ntp

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s