Monday, 26 November 2012

Changing time zone and time in Ubuntu/Linux

This is a quick tutorial. Here we check how to change time zone in linux as well as changing the server time using terminal.

For changing the time zone:

Your server time is in UTC and you want to change it to IST (Indian Standard Time). For this follow the below steps:


1. delete the current time zone file localtime at /etc/

sudo rm /etc/localtime

2. Then symlink the correct time zone to /etc/localtime from /usr/share/zoneinfo/Asia/Kolkata (replace Asia/Kolkata  with your time zone). You can select  your time zone from the location /usr/share/zoneinfo

sudo ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

3. check the time using date command.

date

Mon Nov 26 10:40:38 IST 2012

Changing server time using date command:

Use the below command to change the date in server

1. date --date=mm/dd/yy

eg: date --date=11/26/12

Use the below command to change the time in server

2. date --set=hh:mm:ss

eg: date --set=10:48:38

Check the time in the server using the command date.

3. date

Mon Nov 26 10:40:38 IST 2012

No comments:

Post a Comment