Friday, June 1

How to Change Time Zone in Linux RHEL/CentOS 6&7


Time Zone change is required Some times  when we move our Machines(VMs) from one location to another location.
You can easily change timezone in RHEL/CentOS using the following methods.
Check which time zone you are in by using date command.

Example:
[root@bsrtech ~]# date
Fri Jun  1 12:26:53 IST 2018

Actually My Machine(VM) is moved from India to US(Eastern Time)  Data Centre. Here i am showing change time zone from IST to EDT.

In Linux timezone data is taken from /etc/localtime which is linked to one of the file located in /usr/share/zoneinfo/*
Delete the current localtime file under /etc/ directory, before deleting backup the localtime file

[root@bsrtech ~]# cd /etc
[root@bsrtech ~]# cp /etc/localtime /etc/localtime_bkp_8MAR2018
[root@bsrtech ~]# rm localtime

All US timezones are located under the /usr/share/zoneinfo/US directory as shown below.

[root@bsrtech US]# ls
Alaska    Arizona  Eastern       Hawaii          Michigan  Pacific      Samoa
Aleutian  Central  East-Indiana  Indiana-Starke  Mountain  Pacific-New




Note: For other country timezones, browse the /usr/share/zoneinfo directory.

Link the Eastern file from the above US directory to the /etc/localtime directory as shown below.

[root@bsrtech US]# # ln -s /usr/share/zoneinfo/US/Eastern   /etc/localtime

Now the timezone on your Linux system is changed to US Eastern time as shown below.

[root@bsrtech ~]# date
Fri Jun  1 03:19:21 EDT 2018

Note: The date command can be used for both viewing and changing the date and time. Change the Time using date Command

Set Manual Time
[root@bsrtech ~]# date -s "01 JUNE 2018 02:34:00"
FRI June  1 02:34:00 EDT 2018

6 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thanks For Sharing a very Nice Informative Information which I very Beneficial for everyone Otherwise if anyone Want to Setup / activate Ms Office So Please visit the Website- https://msofficeset-up.com/

    Here is the best Software Company for MS Office Set up
    www.office.com/activate
    office.com/activate

    ReplyDelete
  3. Thank you for sharing this post its very knowledgeable i hope that you will continue to post these kinds of contents in future apart from that if anyone looking for Advance Excel institute in delhi so Contact Here-+91-9311002620 Or Visit Website- https://www.htsindia.com/Courses/business-analytics/adv-excel-training-course

    ReplyDelete
  4. Your post is really good thanks for sharing these kind of post but if anyone looking for Best Consulting Firm for Fake Experience Certificate Providers in mumbai, India with Complete Documents So Dreamsoft Consultancy is the Best Place.Further Details Here- 9599119376 or VisitWebsite-https://experiencecertificates.com/experience-certificate-provider-in-mumbai.html

    ReplyDelete

:: Linux - Legends ::