For CentOS/RHEL 7
Check Current SystemTimezone
First, check current timezone used by your system using date command.
# date
|
As per above output, system current timezone is UTC.
Change Timezone of System
# timedatectl list-timezones
|
Now use the following command to change timezone to Asia/Kolkata.
# timedatectl set-timezone Asia/Kolkata
|
Now timezone has been changed successfully. Let us check timezone again.
For Ubuntu, Debian & LinuxMint
Check Current SystemTimezone
Linux uses /etc/localtime file as current systems timezone. We can simply use “date” command to check current timezone.
# date
|
As per above output, system current timezone is EST.
Change Timezone of System
First, rename or unlink the old file.
$ sudo mv /etc/localtime /etc/localtime.old
|
Now create a symbolic link of /etc/localtime with new timezone settings file. For below example, I am using Asia/Kolkata (IST) timezone for my server
$ sudo ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
|
Now timezone has been changed successfully. Let us check timezone again.