ntpq
systemLinux/Unix
The ntpq command is one of the most frequently used commands in Linux/Unix-like operating systems. ntpq NTP query utility for monitoring NTP daemon ntpd operations
Quick Reference
Command Name:
ntpq
Category:
system
Platform:
Linux/Unix
Basic Usage:
ntpq [options] [arguments]
Common Use Cases
Syntax
ntpq [options] [host...]
Options
Option | Description |
---|---|
-4 |
Force IPv4 DNS resolution |
-6 |
Force IPv6 DNS resolution |
-c command |
Run a specified command and exit |
-d |
Enable debugging output |
-D level |
Set debugging level |
-i |
Force interactive mode |
-n |
Output numeric host addresses instead of hostnames |
-p |
Print a list of peers and their state (shorthand for -c peers) |
-s |
Print a list of peers in a different format |
-t |
Set a timeout in seconds for noninteractive mode |
Common Interactive Mode Commands:
Command | Description |
---|---|
peers | Display a list of peers and their state |
associations | Display association IDs and status |
lpeers | Display a detailed list of peers |
opeers | Display a list of peers in old style format |
rv [association-ID] | Display system variables from the server |
readvar [association-ID] [variable-name] | Read system or peer variables |
clockvar [association-ID] [variable-name] | Read clock variables |
pstats [association-ID] | Show peer statistics |
help | Display help information |
quit | Exit the program |
Peer Status Codes in 'ntpq -p' Output:
Code | Description |
---|---|
* | The peer is the system's current time source (synchronization source) |
o | The peer is a PPS (Pulse Per Second) peer |
+ | The peer is a candidate for selection |
- | The peer is being discarded by the cluster algorithm |
x | The peer is considered a falseticker by the intersection algorithm |
. | The peer is being included in the synchronization |
# | The peer is a selected peer but the distance exceeds the maximum |
Examples
How to Use These Examples
The examples below show common ways to use the ntpq
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
ntpq -p