search by tags

for the user

adventures into the land of the command line

setting date & time

you can change date and time manually with

$ date -s "26 AUG 2015 22:46:16"

but as the clocks on different computers drift from one another, a better solution is to have the clock sync with a computer whose primary purpose is to keep time. to do this, use an application called ntp (network time protocol). it will sync with an ntp server, like many other computers do, to ensure everyone is on the same time.

first make sure ntp is installed on the host

$ sudo yum list installed ntp

if not, install it

$ sudo yum install -y ntp

make sure ntpd starts on reboot, start it and check it has synchronised (takes a minute)

$ chkconfig ntpd on
$ sudo /sbin/service ntpd start
$ ntpstat

find your timezone, then follow the prompts to select your timezone

$ ls -l /usr/share/zoneinfo/
$ tzselect

backup the old timezone file

$ mv /etc/localtime /etc/localtime-old

symlink to the new timezone file

$ ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

$ date
Wed 26 Aug 2015 22:53:23 AEST

and that’s it