How to Sync System Time By Using timedatectl Command On Ubuntu?

How to Sync System Time By Using timedatectl Command On Ubuntu?


The system clocks are not perfect they are prone to drift that means over the time it starts lagging from the actual time. There are many network services that require the correct time on a local system.

So the Network Time Protocol (NTP) provides a way to maintain the accuracy of a system clock. NTP is an internet protocol that is used to synchronize time across the multiple servers.

Ubuntu by default uses timedatectl/timesyncd to synchronize system time with NTP servers optionally anyone can choose the chrony to serve the purpose.

Check the current status of time configuration

You can check the current status of time configuration by using timedatectl command –

timedatectl status

This will display information such as local time, universal time, the system clock is synchronized or not, NTP service is active or not, etc.

In Ubuntu by default NTP service is active and the system clock is synchronized, see the image below.

Enabling NTP service

If NTP service is not active in your system then use the following command –

timedatectl set-ntp true

Also if you want you can disable the NTP service by using –

timedatectl set-ntp false

Note: NTP daemon communicates with the NTP server or peers on the network using UDP packets on port number 123. So firewall in your system should be configured to allow the UDP packets on port 123.

Configure NTP servers

The server from which timedatectl and timesyncd fetch time is specified in the /etc/systemd/timesyncd.conf and the additional configuration files are stored in /etc/systemd/timesynd.conf.d/

You can open the timesyncd.conf using a text editor such as nano

nano /etc/systemd/timesyncd.conf

The configuration file will look something like this –

In the “[Time]” section of this file –

NTP= Contains a list of NTP servers separated by space. When the empty string is assigned the list of NTP server is reset

FallbackNTP= This contains a space-separated list of NTP servers to be used as the fallback NTP servers. This setting is only used when there is no other NTP server information is known.

You can see full details of this section in the man page of timesyncd.conf file –

man timesyncd.conf


By reading this article you can now synchronize your system time with NTP servers. Now if you have a query you can write to us in the comments below.

Previous [ubuntu] Does enabling multiverse of Groovy in Ubuntu 20.04 break the system while updating?
Next usb installation of 20.04 dose not offer installation alongside existing Windows 10

About author

You might also like

Linux Topics 0 Comments

Understanding the Filesystem (Directory Layout) In Linux

This post was last updated on August 1st, 2020 at 12:58 pmEvery computer stores various types of data on a storage device such as hard disk, USB drive, etc. This

Linux Topics 0 Comments

How to check if a disk uses GPT or MBR in Linux?

In a computer, MBR and GPT are two ways of storing the partitioning information on a disk. The MBR is a legacy while GPT is a newer disk partitioning style

Linux Topics 0 Comments

How to Copy Directory in Linux / Unix

This post was last updated on July 21st, 2020 at 01:10 pmIf you are looking to copy a directory in Linux using a command line, then here I have explained


No Comments Yet!

You can be first to comment this post!

Leave a Reply