To set the timezone in CentOS or Ubuntu, see examples below:
timedatectl set-timezone Europe/London
timedatectl set-timezone Africa/Johannesburg
For a list of zones, use these commands:
timedatectl list-timezones timedatectl list-timezones | grep -i europe
Other useful date time commands
This one shows information compared to time sync:
timedatectl
Check if ntp service is running:
service ntp status
Install a more sophisticated time server service (see Notes below):
apt install ntp
Notes:
When you run the above command, you may get this:
Package systemd-timesyncd which provides time-daemon is to be removed
1 thought on “How to set the timezone in Ubuntu and CentOS and some other useful time commands”
great