How to synchronize the time in a Linux system using ntp and chrony
- Published
- Updated
- Reading time
- 2 min

The system time on a Linux machine is stored as the number of seconds since the Unix epoch (January 1, 1970, 00:00:00 UTC). You can display the current system time in a human-readable format using the date command in the terminal. For example:
#date
Changing the system time can have unintended consequences, so be careful when doing so. It’s usually better to use a time synchronization service, such as ntp or chrony, to keep the system time accurate.
Synchronize the time in a Linux system using ntp
To synchronize the time in a Linux system, you can use the ntp (Network Time Protocol) service.
You can install the ntp package with the following command (for Ubuntu/Debian):
#sudo apt-get install ntp
And for Fedora/CentOS:
#sudo yum install ntp
After installation, you can start the ntp service and enable it to start at boot time:
sudo systemctl start ntp
sudo systemctl enable ntp
You can verify the time synchronization with the following command:
#ntpq -p
This will show the list of NTP servers that your system is synchronized with and their offset from the local clock.
Synchronize the time in a Linux system using chrony
chrony is another popular service for synchronizing the system clock on Linux. It is often used as an alternative to ntp due to its more efficient handling of time synchronization in dynamic network environments, such as those with changing IP addresses.
To install chrony on Ubuntu/Debian, you can use the following command:
#sudo apt-get install chrony
And for Fedora/CentOS:
#sudo yum install chrony
After installation, you can start the chrony service and enable it to start at boot time:
#sudo systemctl start chronyd #sudo systemctl enable chronyd
You can verify the time synchronization with the following command:
#chronyc tracking
This will show the state of the system clock and the sources that chrony is using to synchronize it.
Written by
A Computer Science Graduate, who works extensively on open source projects. His Areas Of interest are: Network Security, Linux Administration, FOSS, Python, and C programming.
More from Ajay →$ grep -r "linux" ~/articles
Keep reading

Mastering Kali Linux Commands: A Comprehensive Guide
Introduction: Kali Linux is a popular Linux distribution used by ethical hackers, security professionals, and penetration testers worldwide. It is known for its…
4 min read

How to Stream Your Media with VLC DLNA
Introduction: With the proliferation of digital media, it’s becoming increasingly important to have easy access to all of your files, whether they’re movies, TV…
3 min read

The Ultimate Guide to TACACS: Definition, Benefits & How to Use it
Introduction If you work with network devices, you have likely heard of TACACS (Terminal Access Controller Access Control System). TACACS is a network…
3 min read
