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:
apt install ntp
1 thought on “How to set the timezone in Ubuntu and CentOS and some other useful time commands”
great