How to sync date and time from the command-line in Ubuntu

Learn how to use Chrony to sync the time and date via internet

Ubuntu uses NTP for synchronizing time over the internet. It is a TCP/IP protocol that fetches the current date and time from a server. The NTP servers are connected to atomic clocks via third-party servers.

Going a tad deeper, Ubuntu (16.04 onwards) uses timedatectl / timesyncd services to synchronize time. Optionally, one can use chrony to serve the Network Time Protocol.

Today, let’s learn the command lines to be used in the Terminal to get the date and time synced to the internet atomic clock.

If you ever learned this earlier, you might be remembering ntpdate. This is deprecated and replaced with a powerful timesyncd tool. By default settings, it regularly checks and keeps your computer’s local time in sync. It also stores time updates locally, so that time is maintained even after the reboot.

Checking Current Status

Launch terminal and use the timedatectl command as follows:

timedatectl status

You should see the output similar to this one:

kiran@foss-linux:~$ timedatectl status
Local time: Mon 2018-08-13 21:54:25 EDT
Universal time: Tue 2018-08-14 01:54:25 UTC
RTC time: Tue 2018-08-14 01:54:25
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no

Installing and using Chrony

To install Chrony, enter the following command in the Terminal:

sudo apt install chrony

If you require a one-shot sync use, use the following command in the Terminal.

chronyd -q

If you require a one-shot time check without setting the time, simply enter:


Adding your own time servers

By default settings, Ubuntu fetches date and time from You can view and edit the details. Use ‘Edit’ command in the ‘Terminal’.

Edit /etc/chrony/chrony.conf

By default these servers are configured:

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See for
# more information.
pool iburst
pool iburst
pool iburst
pool iburst

Go ahead and replace the server details as needed and then save the config file. Restart the chrony service for the new settings to take effect.

sudo systemctl restart chrony.service

That’s it! Hope you enjoyed learning the command line way of syncing the date and time of your Ubuntu PC.

Kiran Kumar
Hi there! I'm Kiran Kumar, founder of I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. Hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more, and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!


Please enter your comment!
Please enter your name here




In this article, we will take a look at 10 of the best PDF editors and tools out there in 2019 that are available for Linux platforms. The editors are going to be judged on the basis of their functionalities, portability, ease of installation, price, and convenience.
Test drive linux online
Enter, a website that allows Linux users to test various distros online, without downloading the ISO or installing the distro. With, you can check a distro with no muss, no fuss.
Uninstall Programs in Ubuntu
Uninstallation of programs can be done by graphical way using the Ubuntu Software Center, and the Synaptic Package manager. Command-line way of doing it is also possible using apt-get and aptitude commands. We shall discuss each one of them in detail.