Home > Linux > Change System TimeZone in Linux Systems

Change System TimeZone in Linux Systems

Web Servers are geographically located and their system date depends upon their location. But sometimes our application required to follow certain timezone and for that we will have to change the Time Zone of out system itself. In this article we will learn on how we can change the System Time Zone on Linux.

There are 2 ways in which we can change the Time Zone For Linux System:
1) setup command
2) Copying Time Zone File

setup command:
On linux system we can change the settings that we have set upon installation, this can be achieved using setup command. You can type setup command on command prompt.
Example:

[hitesh@Hitesh ~]$ setup
You are attempting to run "setup" which requires administrative
privileges, but more information is needed in order to do so.
Password for root:

setup command requires root access so even if you are non root user it will still prompt to enter root password to enter. Below is the setup screen that you will see when you go inside setup.

linux setup command screen

linux setup command screen

Click on the Time Zone configuration and click on Run Tool as shown below:

Time Zone Configuration in Linux

Time Zone Configuration in Linux

Here you will be shown all the timezone available on your system, select your desired timezone and click on OK

Select Time Zone on Linux

Select Time Zone on Linux

Exit the setup and now you are set with the timezone.

Copying Time Zone File:
For every timezone there exists an file in our system, that file can be located at /usr/share/zoneinfo folder. You just need to select the appropriate file.
Example:
If you want to select the Time Zone file for India, than select /usr/share/zoneinfo/Asia/Calcutta. Now you just to copy this file and save it into /etc folder by name localtime.

Example:
cp /usr/share/zoneinfo/Asia/Calcutta /etc/localtime – This would set India as my current timezone
cp /usr/share/zoneinfo/Asia/Singapore /etc/localtime – This would set Singapore as my current timezone

There is also other way if you don’t want to copy the file from /usr/share/zoneinfo to /etc/ folder. In this we will be creating an symbolic link where /etc/locatime will point to timezone file located at /usr/share/zoneinfo
Example:
ln -sf /usr/share/zoneinfo/Asia/Karachi /etc/localtime – This would set Pakistan as the Time Zone


Custom Search

Popular Articles:

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • IndianPad
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • RSS
  • Technorati
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Reddit
  • Add to favorites
  • PDF
  • Twitter
Categories: Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.