Thursday, July 18, 2013

How to set correctly current date on linux, mac, etc


How to set timezone on Linux:
Find out your timezone here /usr/share/zoneinfo/
e.g. for Ukraine, Kiev it would be:
/usr/share/zoneinfo/Europe/Kiev

To apply it you need first to remove "localtime" file from etc/localtime
Then create from /usr/share/zoneinfo/Europe/Kiev soft link at /etc/ and name it "localtime", e.g.:
ln -s /usr/share/zoneinfo/Europe/Kiev /etc/localtime

Check created link:
ls -l
... /etc/localtime -> /usr/share/zoneinfo/Europe/Kiev


Update current time on your OS with NTP server:
ntpdate -b pool.ntp.org


Check your current date:
date
Thu Jul 18 13:55:20 EEST 2013

That's it.