Skip to content

Instantly share code, notes, and snippets.

@alphamarket
Last active October 26, 2019 09:54
Show Gist options
  • Save alphamarket/8eedb131db18b060808a86ce8f5a8115 to your computer and use it in GitHub Desktop.
Save alphamarket/8eedb131db18b060808a86ce8f5a8115 to your computer and use it in GitHub Desktop.
Change/Restore Linux's System Date & Time
# disable NTP sync
sudo timedatectl set-ntp false
# set the date-time
sudo timedatectl set-time "2019-10-29 16:20:00"
# set the timezone
sudo timedatectl set-timezone Europe/London
# select & set the timezone
sudo timedatectl set-timezone `timedatectl list-timezones | grep <city>`
# enable the NTP service to auto-update the datetime
sudo timedatectl set-ntp true
# If using a service like chrony or ntpd to make changes,
# these are not shown by timedatectl until systemd-timesyncd is restarted:
sudo systemctl restart systemd-timesyncd
# check timesyncd's status
sudo systemctl status systemd-timesyncd
# check the timedatectl status
timedatectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment