Monday 2 July 2012

Set Timezone Commandline


Set timezone using configuration file

      The timezone configuration file “localtime” is located into “/etc/”directory. It is a symbolic link or a correct timezone file of “/usr/share/zoneinfo/Asia/Calcutta”. The “/usr/share/zoneinfo/” directory contains all pacific and country timezone file.

      Here the example to set the timezone to Calcutta (India) which is located in the Asia directory.

      Process to change timezone:
# cp /ect/localtime /etc/localtime.old
# cat /usr/share/zoneinfo/Asia/Calcutta > /etc/localtime
      or,
# ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
# date (Verify the changed timezone)

      Update time with ntp server using Internet. It will synchronize current time with NTP server.
# ntpdate pool.ntp.org


Set timezone using environment variable

      The “tzselect” command provide to select pacific and country location
# tzselect
      Select continent or ocean by prefix number
      Example: 5 for Asia, then select country 14 for India then press 1 for Yes. It display timezone configuration value. Now append the line in the “/etc/profile” file for make the changes permanently and then log out and log in again.

# vim /etc/profile
      Go to bottom line and enter “export TZ=Asia/Kolkata” without quot.
      :wq
# date (Verify the changed timezone)


      Note: For change timezone graphically, use “system-config-date” command and select timezone tab on the top of the window.

No comments:

Post a Comment

Boot to UEFI Mode or legacy BIOS mode

Boot to UEFI Mode or legacy BIOS mode Choose UEFI or legacy BIOS modes while installing Windows. After Windows is installed, if you nee...