Server Administration & Management

How to set the correct timezone

1. Login as root either locally or remotely via SSH.

2. See what the current timezone is using following command :-

# date

Fri Nov  4 10:33:29 PDT 2011

3. To change the timezone first look at what timezones are available by running the following command on the command line interface:

# ls /usr/share/zoneinfo

Africa      Australia  Cuba     Etc      GMT0       Iceland      Japan      MST      Poland      right      Universal  Zulu
America     Brazil     EET      Europe   GMT-0      Indian       Kwajalein  MST7MDT  Portugal    ROC        US
Antarctica  Canada     Egypt    Factory  GMT+0      Iran         Libya      Navajo   posix       ROK        UTC
Arctic      CET        Eire     GB       Greenwich  iso3166.tab  MET        NZ       posixrules  Singapore  WET
Asia        Chile      EST      GB-Eire  Hongkong   Israel       Mexico     NZ-CHAT  PRC         Turkey     W-SU
Atlantic    CST6CDT    EST5EDT  GMT      HST        Jamaica      Mideast    Pacific  PST8PDT     UCT        zone.tab

4. Then simply delete the current timezone:

# rm /etc/localtime

5. And replace it with a symbolic link to the new timezone from /usr/share/zoneinfo. For example if your chosen zone is Pacific time:

# ln –s /usr/share/zoneinfo/PST8PDT /etc/localtime

November 4, 2011 Posted by | NTP, Tips & Tricks, Unix/Linux | , , , | Leave a comment