How do I sync my Ubuntu system clock?

How To Sync The Ubuntu System Clock? (GUI, TimeDateCtl & NTP)

Time synchronization is an important topic on large networks, especially on Linux computers. A lot of effort has been put into recent system updates to make it work by default, but it doesn’t mean that it does exactly what you want. I will answer all of your questions about time settings in this article.

Ubuntu’s system clock is already synchronized by default with an Internet server using the time zone set during installation, there is nothing else to configure. It’s possible to change this default behavior in the system settings, under “Date & Time”, or via the command line ‘timedatectl’.

I will start by explaining the default setup, then how you can fix the timezone and time synchronization via the interface, and finally, for those who need more, how to use NTP and timedatectl to customize the time synchronization the way you want.

Linux doesn’t have to be intimidating. With my e-book, Master Linux Commands, you’ll uncover the secrets of the terminal in a fun, step-by-step journey. From basics to scripts, get ready to level up your Linux skills. Oh, and did I mention the handy cheat sheet you get as a bonus?

How does Ubuntu sync time?

To find the current configuration on your system, open the Settings app and go to “Date & Time”. By default, “Automatic Date & Time” is enabled, and the time zone should be set to the one you chose during the system installation.

Time synchronization requires Internet access, so if you notice a delay between your Ubuntu system and other computers, it might be the reason. If you can, enable an Internet connection and wait a few minutes, Ubuntu should automatically sync it back to the correct date and time.

Overall, there is nothing to do if your system is properly configured (like in the screenshot) and connected to the Internet. But let’s see how to change these options when needed.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

How to fix the time on Ubuntu?

Ubuntu date & time are automatically synchronized with a server on the Internet, but it’s possible to disable this or change the timezone in the system settings.

How to enable or disable automatic date and time?

  • Open the system settings.
  • Go to “Date & Time”
  • Disable the “Automatic Date & Time” if you want to adjust the date & time manually.
  • A new window appears, where you can configure it manually:
  • Once done, close the window (there is no button, just close it).

That’s it, your date and time are now set the way you want.
Enabling the “Automatic Date & Time” option after that will instantly fix the date by using the Internet server.

How to change the time zone?

Just below the “Automatic Date & Time” option in the system settings, you can change the time zone currently used, or enable “Automatic Time zone” to let the system synchronize it for you.

The “Automatic Time Zone” option will use location services and your Internet IP address to find the correct time zone to use. This is particularly useful if you travel a lot. By enabling this, your system will always show the local time.

By default, the system uses the time zone you selected during the installation. Here is how to use another one:

  • Click on the current time zone (In my previous screenshot, it’s “Paris, France”).
  • The same map you viewed during installation will appear. You can click on the map to set the timezone you want to use. It will also select the biggest city near your click, so try to click exactly where you are (not the timezone only).
  • Close the window to save your changes, the new timezone is immediately used on your system.

You now know how to change the basic settings related to date, time, and timezone on your Ubuntu system. But maybe you were looking for something more advanced, to change the server used for time synchronization, for example. If this is your case, don’t miss the next part!

How to manually sync time on Ubuntu?

Ubuntu has built a user-friendly interface to quickly change the date, time, and timezone. But advanced options are hidden, and command lines are required to change the synchronization server and other settings.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

What is timedatectl on Ubuntu?

Timedatectl is the main tool used by Ubuntu to set up the date and time. It’s included by default in recent releases. Open a terminal and type this command to view the current configuration:
timedatectl

Basically, we can see the same settings as in the graphic interface. By default, Ubuntu has time synchronization enabled, by using the NTP service and your time zone.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Change the current configuration with timedatectl on Ubuntu

Timedatectl is not only used to view the current configuration, but you can also use the same command to make slight changes in it.

Here are some useful commands you can try:

  • List the timezones available:
    timedatectl list-timezones
    timedatectl list-timezones | grep Europe
  • Change the current timezone:
    sudo timedatectl set-timezone <timezone-name>
    sudo timedatectl set-timezone America/New_York
    sudo timedatectl set-timezone Europe/Paris
  • Enable or disable time synchronization:
    sudo timedatectl set-ntp false
    sudo timedatectl set-ntp true
  • Set the current time manually (time synchronization must be disabled first):
    sudo timedatectl set-time 'Y:M:D HH:mm:ss'
    sudo timedatectl set-time 'Y:M:D'
    sudo timedatectl set-time 'HH:mm:ss'

These are the basic command options you need to know about timedatectl. This should be pretty handy on Ubuntu server, or via SSH, to do the same things you can in the graphic interface. But you can’t change the server used directly with these commands, you need to edit the configuration file.

Use another server for time synchronization on Ubuntu

Ubuntu uses timedatectl and NTP by default for time synchronization. The only way to use another server is to edit the configuration file, located at /etc/systemd/timesyncd.conf.

Here is how to do this:

  • Open a terminal, or connect to your Ubuntu system via SSH.
  • Open the configuration file:
    sudo nano /etc/systemd/timesyncd.conf
    Enter your password if needed.
  • The file looks like this:

    Everything is commented by default, but you can see the default configuration.
    Ubuntu date and time is synchronized with ntp.ubuntu.com.
  • To use a custom server, add a new line, starting with FallbackNTP and the server you want to use. It can be a local IP address, a host name or a domain name. You can also set several severs, by separating them with spaces.
    For example:
    FallbackNTP=0.us.pool.ntp.org 1.us.pool.ntp.org
  • Save and exit (CTRL+O, CTRL+X).

A reboot might be required to update the system configuration. The date & time will now be synchronized with your server, instead of the default one.

I hope this tutorial was useful, and answered all your question about time synchronization on Ubuntu. If this concept is still new for you, and you need more explanation on how it works, I highly recommend reading this other guide on how to sync time with a server. It’s for Raspberry Pi OS, but I explain the theory in more detail, and it applies the same way on Ubuntu.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

FAQ

How to enable time synchronization in the command line?

If you get the output “system clock synchronized: no” with timedatectl, you can enable time synchronization with the command:
sudo timedatectl set-ntp true

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

Additional Resources

Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.

VIP Community
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

Similar Posts