Main menu

How to : change date and timezone in linux

Many times you just installed Linux with default parameters and found that your time and zone-info is incorrect. Let’s have. Let’s change date and timezone in Linux

change date and timezone in Linux

Let’s check current date and timezone. Let’s assume you have ran date command and found that your current timezone is UTC and you want to change it to IST timezone.

# date
Mon Jul 15 20:15:17 UTC 2016

In most of distribution timezone is controlled by /etc/localtime file. All timezone files available underneath /usr/share/zoneinfo directory. We just have to replace /etc/localtime file with our zone file.

# cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

Let’s check new time zone

Fri Feb 26 15:17:17 IST 2016

Changing Date and Time

By default system automatically sync time with NTPD if you have internet conction or local NTP server configured. Let’s sync time default NTP server

# ntpd

Manually change date and time with date command set option

date -s "19 APR 2016 10:00:00"

You can also use cal command to check date

# cal