How to change the system time zone from command line in Red Hat Enterprise Linux 6 and earlier

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 3
  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

Issue

  • How can the system timezone be changed from the command line without using system-config-date (or redhat-config-date in RHEL3)?

Resolution

Note: On RHEL 7, there is a different procedure to change time zone from command line.

  1. Find the desired time zone file in the /usr/share/zoneinfo/ directory, for example: "America/New_York", be sure the file /etc/localtime is not a symbolic link or the change will not work:

     # file /etc/localtime 
     /etc/localtime: symbolic link to `/usr/share/zoneinfo/US/Mountain'
     # unlink /etc/localtime
    
  2. Edit /etc/sysconfig/clock and change the ZONE= declaration in to ensure the time zone is read properly by the tzdata-update command each time the tzdata package gets updated (or when system-config-date is run), e.g.:

     ZONE="America/New_York"
    
  3. And finally, run tzdata-update which will reconfigure your system time zone, write the new /etc/localtime and notify the operating system that there was a time zone change. There's no need to reboot.

     # tzdata-update
    
  4. Run the date command to ensure it reports the expected time and date.

Notes on UTC

  • It is generally advisable to configure the system clock to use UTC, which results in the BIOS storing the time in UTC (Content from en.wikipedia.org is not included.Coordinated Universal Time) instead of local time.

  • To enable UTC in RHEL 6, ensure the third line of /etc/adjtime reads as follows:

      UTC
    
    • See man hwclock under the Adjust Function header for details on the /etc/adjtime file.
  • To enable UTC in earlier versions of RHEL, ensure /etc/sysconfig/clock contains a line like the following:

      UTC=true
    
    • See /usr/share/doc/initscripts*/sysconfig.txt for details on the /etc/sysconfig/clock file.
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.