How to Set Time, Timezone and Sync Server Clock in Linux

In this article, learn how to set time, timezone, and synchronize your Linux system clock with NTP using timedatectl, systemd-timesyncd, and chrony.

The ‘timedatectl‘ command is a utility for RHEL-based and Debian-based distributions, and it is a part of the ‘systemd‘ system and service manager, serving as a replacement for the old traditional date command used in ‘sysvinit‘ daemon-based Linux distributions.

The timedatectl command allows you to query and change the configuration of the system clock and its settings, you can use this command to set or change the current date, time, and timezone, or enable automatic system clock synchronization with a remote NTP server.

In this tutorial, am going to take you through the ways you can manage time on your Linux system by setting the date, time, timezone, and synchronize time with NTP from the terminal using timedatectl, systemd-timesyncd, and chrony.

It is always a good practice to maintain the correct time on your Linux server or system, and it can have the following advantages:

  • Maintain the timely operation of system tasks since most tasks in Linux are controlled by time.
  • Accurate time for logging events and other information on the system.
  • Proper synchronization for distributed systems and applications.
  • Essential for security protocols like Kerberos and SSL/TLS certificate validation.

How to Find and Set Local Timezone in Linux

1. To display the current time and date on your system, use the timedatectl command from the command line as follows:

timedatectl  status
Check Linux System Time and Date
Check Linux System Time and Date

In the output above, RTC time is the hardware clock time.

2. The time on your Linux system is always managed through the timezone set on the system, to view your current timezone, do it as follows:

timedatectl 
OR
timedatectl | grep Time
Check Your Linux System Timezone
Check Your Linux System Timezone

3. To view all available timezones, run the command below:

timedatectl list-timezones
List All Timezones on a Linux System
List All Timezones on a Linux System

4. To find the local timezone according to your location, run the following command.

timedatectl list-timezones |  egrep  -o "Asia/B.*"
timedatectl list-timezones |  egrep  -o "Europe/L.*"
timedatectl list-timezones |  egrep  -o "America/N.*"
Find Your Local Timezone in Linux
Find Your Local Timezone in Linux

5. To set your local timezone in Linux, we will use the set-timezone switch as shown below.

sudo timedatectl set-timezone "Asia/Kolkata"
timedatectl status
Set the Local Timezone on a Linux System
Set the Local Timezone on a Linux System

It is always recommended to use and set the coordinated universal time, UTC.

sudo timedatectl set-timezone UTC
timedatectl status
Setting Your System Time to UTC
Setting Your System Time to UTC

You need to type the correct name timezone otherwise you may get errors when changing the timezone, in the following example, the timezone “Asia/Kolkata” is not correct therefore causing the error.

failed to set time zone: invalid timezone

How to Set Time and Date in Linux

You can set the date and time on your system using the timedatectl command as follows:

Set Time in Linux

6. To set time only, we can use a set-time switch along with the format of time in HH:MM:SS (Hour, Minute, and Seconds).

sudo timedatectl set-time 12:25:30
timedatectl status

You may get the following error when setting the date as shown above:

Failed to set time: Automatic time synchronization is enabled

The error occurs because automatic time synchronization (NTP) is enabled, which prevents manual time changes.

To fix it, first disable NTP, then set the time.

sudo timedatectl set-ntp false
sudo timedatectl set-time 12:25:30
timedatectl status
Set Date and Local Time in Linux
Set Date and Local Time in Linux

7. To set both date and time, use the set-time switch along with the format of date in YYYY-MM-DD (Year, Month, Day) and time in HH:MM:SS (Hour, Minute, and Seconds):

sudo timedatectl set-time '2026-01-23 12:25:30'
Configuring Date and Time with YY:MM:DD and HH:MM:SS Format
Configuring Date and Time with YY:MM:DD and HH:MM:SS Format

How to Find and Set Hardware Clock in Linux

8. To set your hardware clock to coordinated universal time, UTC, use the set-local-rtc boolean-value option as follows:

First Find out if your hardware clock is set to the local timezone:

timedatectl | grep local

Set your hardware clock to the local timezone:

sudo timedatectl set-local-rtc 1
Set Your Hardware Clock to UTC on Linux
Set Your Hardware Clock to UTC on Linux

Set your hardware clock to coordinated universal time (UTC):

sudo timedatectl set-local-rtc 0
Set Your Hardware Clock to UTC
Set Your Hardware Clock to UTC
Note: Setting the RTC to local time is not recommended and may cause issues with daylight saving time adjustments, so it is best to keep the RTC in UTC.

Synchronizing Linux System Clock with a Remote NTP Server

NTP stands for Network Time Protocol is an internet protocol, which is used to synchronize the system clock between computers.

The timedatectl utility enables you to automatically sync your Linux system clock with a remote group of servers using NTP.

Most modern Linux distributions use different implementations for NTP synchronization:

  • systemd-timesyncd: A lightweight SNTP (Simple NTP) client built into systemd, which is suitable for most desktop and single-server setups.
  • chrony: A full-featured NTP implementation that can act as both client and server. It handles intermittent network connections better and is more accurate.

Using systemd-timesyncd

To start automatic time synchronization with a remote NTP server, type the following command at the terminal, which will enable and start the systemd-timesyncd service.

sudo timedatectl set-ntp true

To disable NTP time synchronization, type the following command at the terminal.

sudo timedatectl set-ntp false

To check the synchronization status:

timedatectl status

You should see “System clock synchronized: yes” and “NTP service: active“.

Using chrony (Recommended for Servers)

If you’re running a server or need more reliable time synchronization, chrony is the better choice, and it is particularly good for:

  • Systems that don’t run continuously (laptops, desktops).
  • Servers require high accuracy.
  • Systems with intermittent network connectivity.
  • Clustered environments where time consistency is critical.

First, install chrony (if not already installed):

sudo apt install chrony   [On Debian-based systems]
sudo dnf install chrony   [On RHEL-based systems]

Note: Installing chrony will automatically disable systemd-timesyncd to prevent conflicts.

After installation, enable, start, and check synchronization status:

sudo systemctl enable --now chronyd
timedatectl status
Check System Clock Sync Status
Check System Clock Sync Status

To use your own NTP servers instead of the default ones, you need to edit the Chrony configuration file.

sudo nano /etc/chrony/chrony.conf
OR
sudo nano /etc/chrony/sources.d/custom.sources

Add your preferred NTP servers (you can get a list NTP servers from NTP Pool Project).

pool 0.pool.ntp.org iburst
pool 1.pool.ntp.org iburst
pool 2.pool.ntp.org iburst

Restart chrony after changes:

sudo systemctl restart chronyd

Important Notes About NTP Synchronization

  • You cannot run multiple NTP implementations simultaneously, so choose either systemd-timesyncd or chrony.
  • systemd-timesyncd is a client-only implementation and cannot serve time to other systems.
  • chrony can act as both a time client and a time server for your local network.
  • For production servers and critical infrastructure, chrony is generally recommended over systemd-timesyncd.
  • NTP requires UDP port 123 to be open for outbound connections.
Summary

These are very easy examples described in this tutorial and I hope you will find them helpful for setting various Linux system clocks and timezones.

To learn more about this tool, head over to the timedatectl man page.

man timedatectl

If you have anything to say about this article, feel free to leave a comment for any more information to add.

💡 Want to Level Up Your Linux Skills?

Check out Pro.Tecmint.com for ad-free reading, exclusive guides, downloadable resources, and certification prep (RHCSA, RHCE, LFCS) - all with lifetime access.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

16 Comments

Leave a Reply
  1. If I want to set time on different Linux machines in one go or use single command so that all of them stay in sync, is this possible?

    if yes, how we can achieve this?

    Reply
  2. Hi

    I am facing a new issue with my server time every day it exceeds 2 seconds. Can you please suggest the server time synchronization.

    root@bigdata:~# date
    Mon Apr  6 18:17:38 CEST 2020
    root@bigdata:~# timedatectl
                          Local time: Mon 2020-04-06 18:19:48 CEST
                      Universal time: Mon 2020-04-06 16:19:48 UTC
                            RTC time: Mon 2020-04-06 16:19:47
                           Time zone: Europe/Madrid (CEST, +0200)
           System clock synchronized: no
    systemd-timesyncd.service active: no
                     RTC in local TZ: no
    
    Reply
  3. I have one doubt.

    Lets say if i have 2 system and both are in same time zone have “System clock synchronized: yes” or “NTP synchronized: yes” . so does it mean both systems the have exact times.

    Reply
    • @Harshal Wagh

      Yes, they should have the same time if they both have NTP client service running and synced with an NTP server.

      Reply
  4. Thanks for the examples this helped me to quickly set up ntp synchronization.

    One issue found on a minimal Centos7 server install was:

    # timedatectl set-ntp true
    Failed to set ntp: NTP not supported.
    

    The solution was to install chrony. After that the set-ntp true command worked.

    # yum install chrony
    
    Reply
  5. Tip:

    I had problems setting my timezone, e.g.

    # timedatectl set-timezone Europe/Berlin
    

    resulted in

    Failed to set time zone: Invalid time zone 'Europe/Berlin'
    

    though this is listed by timedatectl list-timezones.

    Solution:
    The actual files to which the program timedatectl puts a symlink are very few. E.g.

    ls /usr/share/zoneinfo/Europe/
    

    only lists 3 cities, one for each available timezone in Europe. So find your timezone city (e.g. Paris for Berlin, Copenhagen etc.) and set this if you encounter the same issue.

    Reply
  6. And ofcourse we set “timedatectl set-ntp true” and it magically works, but who sets the desired server, where, how. This is a big mess. Having the systemd and having to manually add the servers to the “/etc/systemd/timesyncd.conf” just looks wrong.

    Also the timestamp of “/etc/systemd/timesyncd.conf” is used for the internal workings of the timedatectl and guess what, if you manually modify this file you will actually change its timestamp. Really, this is a big huge mess.

    Reply
  7. Hello,

    I did the following,

    # timedatectl set-ntp true
    

    But afterwards, the file /etc/systemd/timesyncd.conf, still had the Time servers commented out,

    [Time]
    #Servers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org

    My question is, does the timesyncd.conf file have to be edited after running, timedatectl set-ntp true ?

    Thank you.

    Reply
    • @Brett

      The default the internet cluster of ntp servers will be used. Unless you want to use the specified servers in /etc/systemd/timesyncd.conf, you can leave the time servers commented out.

      Reply
    • I had the very same thought about the animated examples since I came here just for a quick glance at timedatectl syntax and was turned off by visual bloat. Ironically, there’s a typo in item #8 — and the correct syntax can be seen in the GIF.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.