Walker News

How To Change Linux Timezone At Command Prompt?

This guide is for Red Hat Enterprise Linux (or derivatives such as CentOS, Scientific Linux, etc) users, who want to configure RHEL system timezone at command prompt.

Firstly, install the latest tzdata package. Suppose you’ve properly configured the yum repositories, these commands will install / update tzdata:
yum install tzdata
yum update tzdata
Personally, I prefer to use system-config-date or setup program, which can run from Linux command prompt and appears with intuitive text-based GUI. Try it, you’ll like it, and forget about the following steps :)

Now, replace /etc/localtime with the timezone file (installed by tzdata package in /usr/share/zoneinfo directory). For example, to set RHEL system timezone to New York:
cp /usr/share/zoneinfo/America/New_York /etc/localtime

Next, edit the /etc/sysconfig/clock file, set ZONE value to reflect timezone file used:

NOTE: If the BIOS clock is set to use UTC time, then you should also set the UTC value to “true”. Besides, insert this keyword UTC in the 3rd line of /etc/adjtime file, e.g.:
-0.008103 1375208456 0.000000

It’s recommended to have BIOS clock storing UTC time instead of local time, if the RHEL system is using time zone that observes DST. If the system is dual boot with Microsoft Windows OS, then do not configure the BIOS to store UTC time.

Custom Search

2018  •  Privacy Policy