How to change time-zone settings from the command line
I have a virtual machine that is set to PST that a couple of colleagues have in different time-zones.
If I wanted to change the time-zone to EST and GMT, what do I need to do?
Use timedatectl
sudo timedatectl set-timezone <timeszone>
Examples:
-
Timezone as EST
sudo timedatectl set-timezone EST
-
Timezone as UTC
sudo timedatectl set-timezone UTC
-
Listing all valid Timezones
timedatectl list-timezones
This command is perfect for automation scripts since it doesn't require any user interaction while compared to the other given answer based on dpkg-reconfigure tzdata
.
As root you have to execute:
dpkg-reconfigure tzdata
A menu based tool should be started that allows you to change the timezone.
The following also work. For GMT:
ln -sf /usr/share/zoneinfo/GMT /etc/localtime
For EST:
ln -sf /usr/share/zoneinfo/EST /etc/localtime
The most ease way especially to a server is to list timezones:
timedatectl list-timezones
And choose yours, for example:
timedatectl set-timezone Europe/Athens
Thats it! , :-)