How to set timezone from shell quickly

The easiest trick is to override /etc/localtime:

# ln -sf /usr/share/zoneinfo/Europe/Prague /etc/localtime

According to the BIOS clocks and BIOS-UTC setting of the OS it is usually good idea to correct time:

# date +%T -s "22:30"

It's also quite good idea to start NTP daemon:

# service ntpd restart
# chkconfig ntpd on


For Fedora/RHEL systems you should also update sysconfig file to make this permanent:

# echo 'ZONE="Europe/Prague"' > /etc/sysconfig/clock

This is very important if you run a virtual guest since clocks are not very accurate for them.
25 August 2011 | bash | fedora | shell
twitter.com linkedin.com
google.com/+ facebook.com
flickr.com youtube.com