Keep Your Clock Sync with Internet Time Servers in Ubuntu 18.04

Sync system time by NTP on Ubuntu

It is best practice to keep your clock synchronized with the internet according to your specified time zone unless there is a need to alter system time manually. This article describes ways through the command line and the graphical user interface of Ubuntu 18.04 LTS (Bionic Beaver) to keep your clock sync with the internet time servers. This facility was originally developed for older computers that had trouble keeping up with the current time.

Sync Clock with Time Servers through the Command Line

Check Current Time Status

The timedatectl command lets you check the current time status of your system clock. Open your Ubuntu terminal through Ctrl+Alt+T and enter the following command:

$ timedatectl status

Check time with timedatectl

Among other details, you can see the Local time, the Universal time and also if your system clock is synchronized with the internet time servers or not.

Synchronize the System Time

The chronyd command lets you check the time by which your system clock is off. If you run a chronyd command without installing the utility first, you will get the following message:

The chronyd command

Please install the Chrony utility as follows:

$ sudo apt install chrony

Install software: chrony

You can then use the following command to see how much your time varies from the internet server. The “System clock wrong by” line in the output indicates this thing.

$ sudo chronyd -Q

You can also synchronize the system time and see the “System clock wrong by” information in one go through the following command:

$ sudo chronyd -q

In the following example, you can see that when I first ran the chronyd -q command, my system was off by 95.9 seconds. After running the command, my internet time was reset and that can be observed when I re-ran the command. This time my system clock is only off by -0.001446 seconds which is an ignorable difference.

Using chronyd

On the Ubuntu Desktop (GUI)

Operating Systems these days are set to fetch Date & Time and Time zones automatically through the internet. You can set your system to fetch date and time according to the selected time zone as follows:

Click the downward arrow located at the top right corner of your Ubuntu desktop and then click the settings icon located at the bottom left corner:

Click on settings Icon

OR

Type Settings in the Ubuntu Dash as follows:

Open settings

Click the Details tab and then select the Date & Time option.

Make sure your Automatic Date & Time button is turned on. This will enable you to automatically fetch the current date and time from the internet server.

Automatic date and time synchronisation

By following the steps described in this tutorial, you can be 100 percent sure that the current time of your system is in sync with that of your internet time server.