NTP stands for Network Time Protocol and is used for clock synchronization across multiple computers. Client systems can be configured to query an NTP server on a consistent basis, to make sure that its configured time is always kept in sync. There are NTPD servers available over the internet to which you can sync, or you can run your own NTPD server and configure client computers to sync their times to it. Having an array of computers in perfect sync with each other can be important for critical tasks that require perfect coordination between multiple systems.
In this tutorial, we will show you how to query an NTP server on a Linux system. Querying an NTP server is how client machines retrieve the latest time related data from the server, and update their internal clock accordingly. We can query an NTP server and have it update our time, or we can just query it as a test run to ensure connectivity. Let’s look at all the various options below.
In this tutorial you will learn:
- How to install the NTP client on all major Linux distros
- How to query and synchronize time with NTP server
- How to query NTP server without setting time

Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux distro |
Software | NTP client |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
NTP Installation
First, in order to access the NTP related commands, we will need to make sure the requisite package is installed on our system. You can use the appropriate command below to install NTP with your system’s package manager.
To install NTP on Ubuntu, Debian, and Linux Mint:
$ sudo apt update $ sudo apt install ntpdate
To install NTP on Fedora, CentOS, AlmaLinux, and Red Hat:
$ sudo dnf install ntpsec
To install NTP on Arch Linux and Manjaro:
$ sudo pacman -S ntp
These commands will install the NTP client. You will need access to an NTP server in order to synchronize your system’s time. This can either be a local NTP server or one from the internet. See the NTP Pool Project website for a list of public NTP servers that you can configure your client machine(s) to connect to.
How to query NTP server
See the command examples below to learn how to query an NTP server. We will also go over some other related commands that you may find useful.
- To query an NTP server and also update your system time to match the server’s response, we can use the
ntpdate
command followed by the IP address or hostname of the NTP server that we want to sync with. For this example, we will use the genericpool.ntp.org
address, which automatically connects us with a public time server in our region.$ sudo ntpdate pool.ntp.org 15 Apr 21:07:50 ntpdate[8877]: adjust time server 69.89.207.199 offset -0.134500 sec
- To query the time server (or pool) only, without setting the clock, we can append the
-q
option. In this example, we are querying a pool, so multiple NTP servers are listed in the response.$ sudo ntpdate -q pool.ntp.org server 45.79.214.107, stratum 2, offset -0.098260, delay 0.08093 server 64.62.194.189, stratum 3, offset -0.097432, delay 0.06046 server 23.131.64.12, stratum 2, offset -0.096403, delay 0.05975 server 216.66.48.42, stratum 1, offset -0.099252, delay 0.09805 15 Apr 21:09:02 ntpdate[8881]: adjust time server 216.66.48.42 offset -0.099252 sec
That’s all there is to it. If you would like to see additional configuration that can keep your client machines in sync with time servers on a cosntant basis, see our other tutorial on How to synchronize time with NTPD time server.
Closing Thoughts
In this tutorial, we saw how to query an NTP server on a Linux system. Querying an NTP server allows us to synchronize our local client machine with the time that is given to us by the NTP server. In addition, we can query a time server without actually setting the time that is given to us in response, which can be useful for testing our connection to a time server and for troubleshooting.