Saturday, April 24, 2010

LINUX: Setting the Date/Time

These instructions were written up for a Linux Fedora Core 3 system. I think it is handled differently on later versions. And ideally you should just point to a NTP server to make your life easier, but in the event that your company firewalls wont allow that, these instructions will help for a standalone system.

There are more complicated explanations on making sure the timezone is set properly and such, but to simply change the time/date, use the following to set the UTC time. Notice that UTC is different than the current time zone most likely, so calculate it accordingly. It is easy enough to just google "time UTC" and find out what it is at this moment.
$ date -u

Obviously mm is month, dd is day, hh is hour in 24-hour time, mm is minutes, yyyy is 4 digit year, and ss is seconds. Again, this is the UTC. Once you set that, typing date will show the current time/date based on your zone. To set the zone, you can link /etc/localtime to the right timezone file in /usr/share/zoneinfo by typing:
$ ln -s /usr/share/zoneinfo/EST /etc/localtime

If you have a /etc/localtime file there already, you will need to move it out of the way.

No comments:

Post a Comment