Saturday, April 07, 2007

Date Time Clocks

Setting the timezone:
ln -sf /usr/share/zoneinfo/your/zone /etc/localtime

Setting the timezone for a particular user:
export TZ=America/Chicago

Show time in a given timezone:
# relative to the /usr/share/zoneinfo/ directory
zdump Japan
zdump America/Chicago
zdump US/Central

# absolute path to zonefile
zdump /etc/localtime
zdump /usr/share/zoneinfo/America/Chicago

View date and time:
date --utc #universal time

Set the date and time:
date -s "16:15:00" # just the time
date -s "16:15:00 April 7, 2007" # date and time
date 040716552007.00 # the fields being

Verify connectivity with NTP server:
ntpdate -q

Several common time servers:

Manually use NTP to set time:
ntpdate -v # verbose output

Use NTPd to automatically set date and time:
/etc/init.d/ntpd start #ntpd must be installed, of course

Monitor NTPd:
ntpdc -p
ntpdc -p -n

No comments: