Archive for December, 2013

How to change date of linux to UTC/GMT?

Posted: December 3, 2013 in other

Assume that your current timezone is UTC as shown below. You would like to change this to London ie in GMT.

# date
Tue Dec 3 10:02:02 UTC 2013

On some distributions (for example, CentOS), the timezone is controlled by /etc/localtime file.

Delete or move the current localtime file under /etc/ directory

# cd /etc
# rm -rf localtime or #mv localtime localtime.bak

All Europe timezones are located under the /usr/share/zoneinfo/Europe directory as shown below:

# ls /usr/share/zoneinfo/Europe/
Amsterdam Busingen Kaliningrad Monaco San_Marino Vaduz
Andorra Chisinau Kiev Moscow Sarajevo Vatican
Athens Copenhagen Lisbon Nicosia Simferopol Vienna
Belfast Dublin Ljubljana Oslo Skopje Vilnius
Belgrade Gibraltar London Paris Sofia Volgograd
Berlin Guernsey Luxembourg Podgorica Stockholm Warsaw
Bratislava Helsinki Madrid Prague Tallinn Zagreb
Brussels Isle_of_Man Malta Riga Tirane Zaporozhye
Bucharest Istanbul Mariehamn Rome Tiraspol Zurich
Budapest Jersey Minsk Samara Uzhgorod

Note: For other country timezones, browse the /usr/share/zoneinfo directory

Link the London file from the above Europe directory to the /etc/localtime directory as shown below:

#ln -s /usr/share/zoneinfo/Europe/London localtime

Now the timezone on your Linux system is changed to Europe/London time as shown below.

Tue Dec 3 10:11:43 GMT 2013