{
    "mode": "man",
    "parameter": "ntpq",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/ntpq/json",
    "generated": "2026-09-13T09:07:27Z",
    "synopsis": "ntpq [-46adhinpkwWu] [-c command] [host] [...]",
    "sections": {
        "NAME": {
            "content": "ntpq - standard NTP query program\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ntpq [-46adhinpkwWu] [-c command] [host] [...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The ntpq utility program is used to monitor NTP daemon ntpd operations and determine\nperformance. It uses the standard NTP mode 6 control message formats defined in Appendix B of\nthe NTPv3 specification RFC 1305. The same formats are used in NTPv4, although some of the\nvariable names have changed, and new ones added. The description on this page is for the\nNTPv4 variables.\n\nThe program can be run either in interactive mode or controlled using command line arguments.\nRequests to read and write arbitrary variables can be assembled, with raw and pretty-printed\noutput options being available. It can also obtain and print a list of peers in a common\nformat by sending multiple queries to the server.\n\nIf one or more request options are included on the command line when ntpq is executed, each\nof the requests will be sent to the NTP servers running on each of the hosts given as command\nline arguments, or on localhost by default. If no request options are given, ntpq will\nattempt to read commands from the standard input and execute these on the NTP server running\non the first host given on the command line, again defaulting to localhost when no other host\nis specified. ntpq will prompt for commands if the standard input is a terminal device.\n\nntpq uses NTP mode 6 packets to communicate with the NTP server, and hence can be used to\nquery any compatible server on the network which permits it. Note that since NTP is a UDP\nprotocol this communication will be somewhat unreliable, especially over large distances in\nterms of network topology. ntpq makes one attempt to retransmit requests and will time\nrequests out if the remote host is not heard from within a suitable timeout time.\n\nNote that in contexts where a host name is expected, a -4 qualifier preceding the host name\nforces DNS resolution to the IPv4 namespace, while a -6 qualifier forces DNS resolution to\nthe IPv6 namespace.\n\nFor examples and usage, see the \u001b[34mNTP Debugging \u001b[0m<debug.html> Techniques\"  page.\n\nFor a simpler near-real-time monitor, see ntpmon(1).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Command line options are described following. Specifying the command line options -c or -p\nwill cause the specified query (queries) to be sent to the indicated host(s) immediately.\nOtherwise, ntpq will attempt to read interactive format commands from the standard input.\n\n-4, --ipv4\nForce DNS resolution of following host names on the command line to the IPv4 namespace.\n\n-6, --ipv6\nForce DNS resolution of following host names on the command line to the IPv6 namespace.\n\n-a num, --authentication=num\nEnable authentication with the numbered key.\n\n-c cmd, --command=cmd\nThe following argument is interpreted as an interactive format command and is added to\nthe list of commands to be executed on the specified host(s). Multiple -c options may be\ngiven.\n",
            "subsections": [
                {
                    "name": "-d, --debug",
                    "content": "Increase debugging level by 1.\n\n-D num, --set-debug-level=num\nThe debug level is set to the following integer argument.\n\n-l filename, --logfile=filename\nLog debugging output to the specified file.\n",
                    "flag": "-d",
                    "long": "--debug"
                },
                {
                    "name": "-h, --help",
                    "content": "Print a usage message summarizing options end exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-n, --numeric",
                    "content": "Output all host addresses in numeric format rather than converting to the canonical host\nnames. You may get hostnames anyway for peers in the initialization phase before DNS has\nresolved the peer name.\n",
                    "flag": "-n",
                    "long": "--numeric"
                },
                {
                    "name": "-s, --srcname",
                    "content": "Output host addresses by: Names passed to ntpd, then names reverse resolved from\naddresses and finally, IP addresses themselves\n",
                    "flag": "-s",
                    "long": "--srcname"
                },
                {
                    "name": "-S, --srcnumber",
                    "content": "Output host addresses by: Names passed to ntpd, then IP addresses themselves\n",
                    "flag": "-S",
                    "long": "--srcnumber"
                },
                {
                    "name": "-p, --peers",
                    "content": "Print a list of the peers known to the server as well as a summary of their state; this\nis equivalent to the peers interactive command. The refid field is as described under\n\"Event Messages and Status Words\" in the NTP documentation on the Web.\n\n-k filename, --keyfile=filename\nSpecify a keyfile. ntpq will look in this file for the key specified with -a.\n",
                    "flag": "-p",
                    "long": "--peers"
                },
                {
                    "name": "-V, --version",
                    "content": "Print the version string and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-w, --wide",
                    "content": "Wide mode: if the host name or IP Address doesn’t fit, write the full name/address and\nindent the next line, so columns line up. The default truncates the name or address.\n\n-W num, --width=num\nForce the terminal width. Only relevant for composition of the peers display.\n",
                    "flag": "-w",
                    "long": "--wide"
                },
                {
                    "name": "-u, --units",
                    "content": "Display timing information with units.\n",
                    "flag": "-u",
                    "long": "--units"
                }
            ]
        },
        "INTERNAL COMMANDS": {
            "content": "Interactive format commands consist of a keyword followed by zero to four arguments. Only\nenough characters of the full keyword to uniquely identify the command need be typed. The\noutput of a command is normally sent to the standard output, but optionally the output of\nindividual commands may be sent to a file by appending a >, followed by a file name, to the\ncommand line. Some interactive format commands are executed entirely within the ntpq program\nitself and do not result in NTP mode 6 requests being sent to a server. These are described\nas following.\n\n? [commandkeyword], help [commandkeyword]\nA ? by itself will print a list of all the command keywords known to ntpq. A ? followed\nby a command keyword will print function and usage information about the command.\n\naddvars name [ = value] [...]; rmvars name [...]; clearvars\nThe arguments to this command consist of a list of items of the form name = value, where\nthe = value is ignored and can be omitted in read requests. ntpq maintains an internal\nlist in which data to be included in control messages can be assembled and sent using the\nreadlist and writelist commands described below. The addvars command allows variables and\noptional values to be added to the list. If more than one variable is to be added, the\nlist should be comma-separated and not contain white space. The rmvars command can be\nused to remove individual variables from the list, while the clearlist command removes\nall variables from the list.\n\nauthenticate [yes | no]\nNormally ntpq does not authenticate requests unless they are write requests. The command\nauthenticate yes causes ntpq to send authentication with all requests it makes.\nAuthenticated requests causes some servers to handle requests slightly differently. The\ncommand authenticate without arguments causes ntpq to display whether or not ntpq is\ncurrently authenticating requests.\n\ncooked\nDisplay server messages in prettyprint format.\n\ndebug more | less | off\nTurns internal query program debugging on and off.\n\nnoflake, +doflake probability\nDisables or enables the dropping of control packets by ntpq for testing. Probabilities 0\nand 1 should be certainly accepted and discarded respectively. No default, but 0.1 should\nbe a one in ten loss rate.\n\nlogfile <stderr> | filename\nDisplays or sets the file for debug logging. <stderr> will send logs to standard error.\n\ndelay milliseconds\nSpecify a time interval to be added to timestamps included in requests which require\nauthentication; this is used to enable (unreliable) server reconfiguration over long\ndelay network paths or between machines whose clocks are unsynchronized. The server does\nnot now require timestamps in authenticated requests so that this command may be\nobsolete.\n\nexit\nExit ntpq.\n\nhost name\nSet the host to which future queries will be sent. The name may be either a DNS name or a\nnumeric address.\n\nhostnames [yes | no]\nIf yes is specified, host names are printed in information displays. If no is specified,\nnumeric addresses are printed instead. The default is yes unless modified using the\ncommand line -n switch.\n\nkeyid keyid\nThis command specifies the key number to be used to authenticate configuration requests;\nthis must correspond to a key ID configured with the controlkey command in the server’s\nntp.conf\n\nkeytype\nSpecify the digest algorithm to use for authenticated requests, with default MD5. The\nkeytype must match what the server is expecting for the specified key ID.\n\nntpversion 1 | 2 | 3 | 4\nSets the NTP version number which ntpq claims in packets. Defaults to 2, Note that mode 6\ncontrol messages (and modes, for that matter) didn’t exist in NTP version 1.\n\npasswd\nThis command prompts for a password to authenticate requests. The password must match\nwhat the server is expecting. Passwords longer than 20 bytes are assumed to be hex\nencoding.\n\nquit\nExit ntpq.\n\nraw\nDisplay server messages as received and without reformatting. The only\nformatting/interpretation done on the data is to transform non-ASCII data into a\nprintable (but barely understandable) form.\n\ntimeout milliseconds\nSpecify a timeout period for responses to server queries. The default is about 5000\nmilliseconds. Note that since ntpq retries each query once after a timeout, the total\nwaiting time for a timeout will be twice the timeout value set.\n\nunits\nToggle whether times in the peers display are shown with units.\n\nversion\nPrint the version of the ntpq program.\n",
            "subsections": []
        },
        "CONTROL MESSAGE COMMANDS": {
            "content": "Association IDs are used to identify system, peer and clock variables. System variables are\nassigned an association ID of zero and system name space, while each association is assigned\na nonzero association ID and peer namespace. Most control commands send a single mode 6\nmessage to the server and expect a single response message. The exceptions are the peers\ncommand, which sends a series of messages, and the mreadlist and mreadvar commands, which\niterate over a range of associations.\n\nassociations\nDisplay a list of mobilized associations in the form\n\nind assid status conf reach auth condition lastevent cnt\n┌────────────┬───────────────────────────────────┐\n│            │                                   │\n│ Variable   │ Description                       │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ ind        │ index on this list                │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ assid      │ association ID                    │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ status     │ \u001b[34mpeer status word                  \u001b[0m│\n│            │ <decode.html#peer>                │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ conf       │ yes: persistent, no: ephemeral    │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ reach      │ yes: reachable, no: unreachable   │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ auth       │ ok, yes, bad and none             │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ condition  │ selection status (see the select  │\n│            │ field of the \u001b[34mpeer status word     \u001b[0m│\n│            │ <decode.html#peer>)               │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ lastevent │ event report (see the event field │\n│            │ of the \u001b[34mpeer \u001b[0m<decode.html#peer>    │\n│            │ status word\" )                    │\n├────────────┼───────────────────────────────────┤\n│            │                                   │\n│ cnt        │ event count (see the count field  │\n│            │ of the \u001b[34mpeer \u001b[0m<decode.html#peer>    │\n│            │ status word\" )                    │\n└────────────┴───────────────────────────────────┘\n\n\nauthinfo\nDisplay the authentication statistics.\n\nclockvar assocID [name [ = value [...] ][...], cv assocID [name [ = value [...] ][...]\nDisplay a list of \u001b[34mclock variables \u001b[0m<#clock> for those associations supporting a reference\nclock.\n\n:config [...]\nSend the remainder of the command line, including whitespace, to the server as a run-time\nconfiguration command in the same format as the configuration file. This command is\nexperimental until further notice and clarification. Authentication is of course\nrequired.\n\nconfig-from-file filename\nSend each line of filename to the server as run-time configuration commands in the same\nformat as the configuration file. This command is experimental until further notice and\nclarification. Authentication is required.\n\nifstats\nDisplay statistics for each local network address. Authentication is required.\n\niostats\nDisplay network and reference clock I/O statistics.\n\nkerninfo\nDisplay kernel loop and PPS statistics. As with other ntpq output, times are in\nmilliseconds. The precision value displayed is in milliseconds as well, unlike the\nprecision system variable.\n\nlassociations\nPerform the same function as the associations command, except display mobilized and\nunmobilized associations.\n\nlpeers [-4 | -6]\nPrint a peer spreadsheet for the appropriate IP version(s). dstadr (associated with any\ngiven IP version).\n\nmonstats\nDisplay monitor facility statistics.\n\ndirect\nNormally, the mrulist command retrieves an entire MRU report (possibly consisting of more\nthan one MRU span), sorts it, and presents the result. But attempting to fetch an entire\nMRU report may fail on a server so loaded that none of its MRU entries age out before\nthey are shipped. With this option, each segment is reported as it arrives.\n\nmrulist [limited | kod | mincount=count | mindrop=drop | minscore=score | maxlstint=seconds |\nminlstint=seconds | laddr=localaddr | sort=sortorder | resany=hexmask | resall=hexmask |\nlimit=limit | addr.num=address]\nObtain and print traffic counts collected and maintained by the monitor facility. This is\nuseful for tracking who uses or abuses your server.\n\nExcept for sort=sortorder, the options filter the list returned by ntpd. The limited and\nkod options return only entries representing client addresses from which the last packet\nreceived triggered either discarding or a KoD response. the addr.num= option adds\nspecific addresses to retrieve when limit=1. Values of 0 to 15 are supported for num.\nAlso, used internally with last.num=hextime to select the starting point for retrieving\ncontinued response. the frags=frags option limits the number of datagrams (fragments) in\nresponse. Used by newer ntpq versions instead of limit= when retrieving multiple entries.\nThe limit= option limits the MRU entries returned per response. limit=1 is a special\ncase:  Instead of fetching beginning with the supplied starting points (provided by a\nlast.x and addr.x where 0 ⇐ x ⇐ 15, default the beginning of time) newer neighbor, fetch\nthe supplied entries. This enables fetching multiple entries from given IP addresses\n(provided by addr.x= entries where 0 ⇐ x ⇐ 15). When limit is not one and frags= is\nprovided, the fragment limit controls. NOTE: a single mrulist command may cause many\nquery/response rounds allowing limits as low as 3 to potentially retrieve thousands of\nentries in responses. The mincount=count option filters out entries that have received\nless than count packets. The mindrop=drop option filters out entries that have dropped\nless than drop packets. The minscore=score option filters out entries with a score less\nthan score. The maxlstint=seconds option filters out entries where no packets have\narrived within seconds. The minlstint=seconds option filters out entries with a packet\nhas arrived within seconds. The laddr=localaddr option filters out entries for packets\nreceived on any local address other than localaddr. resany=hexmask and resall=hexmask\nfilter entries containing none or less than all, respectively, of the bits in hexmask,\nwhich must begin with 0x.\n\nThe sortorder defaults to lstint and may be any of addr, count, avgint, lstint, score,\ndrop or any of those preceded by a minus sign (hyphen) to reverse the sort order. The\noutput columns are:\n┌────────────────┬───────────────────────────────────┐\n│                │                                   │\n│ Column         │ Description                       │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ lstint         │ Interval in s between the receipt │\n│                │ of the most recent packet from    │\n│                │ this address and the completion   │\n│                │ of the retrieval of the MRU list  │\n│                │ by ntpq.                          │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ avgint         │ Average interval in s between     │\n│                │ packets from this address.        │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ rstr           │ Restriction flags associated with │\n│                │ this address. Most are copied     │\n│                │ unchanged from the matching       │\n│                │ restrict command, however 0x400   │\n│                │ (kod) and 0x20 (limited) flags    │\n│                │ are cleared unless the last       │\n│                │ packet from this address          │\n│                │ triggered a rate control          │\n│                │ response.                         │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ r              │ Rate control indicator, either a  │\n│                │ period, L or K for no rate        │\n│                │ control response, rate limiting   │\n│                │ by discarding, or rate limiting   │\n│                │ with a KoD response,              │\n│                │ respectively.                     │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ m              │ Packet mode.                      │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ v              │ Packet version number.            │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ count          │ Packets received from this        │\n│                │ address.                          │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ score          │ Packets per second (averaged with │\n│                │ exponential decay).               │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ drop           │ Packets dropped (or KoDed) from   │\n│                │ this address.                     │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ rport          │ Source port of last packet from   │\n│                │ this address.                     │\n├────────────────┼───────────────────────────────────┤\n│                │                                   │\n│ remote address │ DNS name, numeric address, or     │\n│                │ address followed by claimed DNS   │\n│                │ name which could not be verified  │\n│                │ in parentheses.                   │\n└────────────────┴───────────────────────────────────┘\n\n\nmreadvar assocID assocID [ variablename [ = value[ ... ], mrv assocID assocID [\nvariablename [ = value[ ... ]\nPerform the same function as the readvar command, except for a range of association IDs.\nThis range is determined from the association list cached by the most recent associations\ncommand.\n\nopeers\nObtain and print the old-style list of all peers and clients showing dstadr (associated\nwith any given IP version), rather than the refid.\n\npassociations\nPerform the same function as the associations command, except that it uses previously\nstored data rather than making a new query.\n\npeers\nDisplay a list of peers in the form\n\ntally remote refid st t when pool reach delay offset jitter\n┌──────────┬───────────────────────────────────┐\n│          │                                   │\n│ Variable │ Description                       │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ tally    │ single-character code indicating  │\n│          │ current value of the select field │\n│          │ of the \u001b[34mpeer status word           \u001b[0m│\n│          │ <decode.html#peer>                │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ remote   │ host name (or IP number) of peer  │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ refid    │ association ID or \u001b[34mkiss code       \u001b[0m│\n│          │ <decode.html#kiss>                │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ st       │ stratum                           │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ t        │ u: unicast or manycast client, l: │\n│          │ local (reference clock), s:       │\n│          │ symmetric (peer), server, B:      │\n│          │ broadcast server, 1-8 NTS unicast │\n│          │ with this number of cookies       │\n│          │ stored.                           │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ when     │ sec/min/hr since last received    │\n│          │ packet                            │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ poll     │ poll interval (log2 s)            │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ reach    │ reach shift register (octal)      │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ delay    │ roundtrip delay                   │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ offset   │ offset of server relative to this │\n│          │ host                              │\n├──────────┼───────────────────────────────────┤\n│          │                                   │\n│ jitter   │ jitter                            │\n└──────────┴───────────────────────────────────┘\n\n\nThe tally code is one of the following:\n┌──────┬───────────────────────────────────┐\n│      │                                   │\n│ Code │ Description                       │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│      │ discarded as not valid            │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ x    │ discarded by intersection         │\n│      │ algorithm                         │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ .    │ discarded by table overflow (not  │\n│      │ used)                             │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ -    │ discarded by the cluster          │\n│      │ algorithm                         │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ +    │ included by the combine algorithm │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ #    │ backup (more than tos maxclock    │\n│      │ sources)                          │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ *    │ system peer                       │\n├──────┼───────────────────────────────────┤\n│      │                                   │\n│ o    │ PPS peer (when the prefer peer is │\n│      │ valid)                            │\n└──────┴───────────────────────────────────┘\n\n\napeers\nDisplay a list of peers in the form:\n\n[tally]remote refid assid st t when pool reach delay offset jitter\n\nwhere the output is just like the peers command except that the refid is displayed in hex\nformat and the association number is also displayed.\n\nrpeers\nDisplay a list of peers in the form\n\nst t when pool reach delay offset jitter refid tally remote\n\npstats assocID\nShow the statistics for the peer with the given assocID.\n\nreadvar assocID [ name ] [,...], rv assocID [ name ] [,...]\nDisplay the specified variables. If assocID is zero, the variables are from the \u001b[34msystem\u001b[0m\n\u001b[34mvariables \u001b[0m<#system> name space, otherwise they are from the \u001b[34mpeer variables \u001b[0m<#peer> name\nspace. The assocID is required, as the same name can occur in both spaces. If no name is\nincluded, all operative variables in the name space are displayed. In this case only, if\nthe assocID is omitted, it is assumed zero. Multiple names are specified with comma\nseparators and without whitespace. Note that time values are represented in milliseconds\nand frequency values in parts-per-million (PPM). Some NTP timestamps are represented in\nthe format YYYYMMDDTTTT, where YYYY is the year, MM the month of the year, DD the day of\nthe month and TTTT the time of day.\n\nreslist\nShow the access control (restrict) list for ntpq.\n\ntimerstats\nDisplay interval timer counters.\n\nwritelist assocID\nWrite the system or peer variables included in the variable list.\n\nwritevar assocID name = value [,...]\nWrite the specified variables. If the assocID is zero, the variables are from the \u001b[34msystem\u001b[0m\n\u001b[34mvariables \u001b[0m<#system> name space, otherwise they are from the \u001b[34mpeer variables \u001b[0m<#peer> name\nspace. The assocID is required, as the same name can occur in both spaces.\n\nsysinfo\nDisplay operational summary.\n\nsysstats\nPrint statistics counters maintained in the protocol module. Note that the relationships\namong these counters can look unlikely because packets can get flagged for inclusion in\nexception statistics in more than one way, for example by having both a bad length and an\nold version.\n\nntsinfo\nDisplay a summary of the NTS state, including both the the NTS client and NTS server\ncomponents. Note that the format of the output text may change as this feature is\ndeveloped. This command is experimental until further notice and clarification.\n",
            "subsections": []
        },
        "AUTHENTICATION": {
            "content": "Four commands require authentication to the server: config-from-file, config, ifstats, and\nreslist. An authkey file must be in place and a control key declared in ntp.conf for these\ncommands to work.\n\nIf you are running as root or otherwise have read access to the authkey and ntp.conf file,\nntpq will mine the required credentials for you. Otherwise, you will be prompted to enter a\nkey ID and password.\n\nCredentials once entered, are retained and used for the duration of your ntpq session.\n",
            "subsections": []
        },
        "STATUS WORDS AND KISS CODES": {
            "content": "The current state of the operating program is shown in a set of status words maintained by\nthe system and each association separately. These words are displayed in the rv and as\ncommands both in hexadecimal and decoded short tip strings. The codes, tips, and short\nexplanations are on the \u001b[34mEvent Messages and Status Words \u001b[0m<decode.html> page. The page also\nincludes a list of system and peer messages, the code for the latest of which is included in\nthe status word.\n\nInformation resulting from protocol machine state transitions is displayed using an informal\nset of ASCII strings called \u001b[34mkiss codes \u001b[0m<decode.html#kiss>. The original purpose was for\nkiss-o'-death (KoD) packets sent by the server to advise the client of an unusual condition.\nThey are now displayed, when appropriate, in the reference identifier field in various\nbillboards.\n",
            "subsections": []
        },
        "SYSTEM VARIABLES": {
            "content": "The following system variables appear in the rv billboard. Not all variables are displayed in\nsome configurations.\n┌────────────┬─────────────────────────────────┐\n│            │                                 │\n│ Variable   │ Description                     │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ status     │ \u001b[34msystem status word              \u001b[0m│\n│            │ <decode.html#sys>               │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ version    │ NTP software version and build  │\n│            │ time                            │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ processor  │ hardware platform and version   │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ system     │ operating system and version    │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ leap       │ leap warning indicator (0-3)    │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ stratum    │ stratum (1-15)                  │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ precision  │ precision (log2 s)              │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ rootdelay  │ total roundtrip delay to the    │\n│            │ primary reference clock         │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ rootdisp   │ total dispersion to the primary │\n│            │ reference clock                 │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ peer       │ system peer association ID      │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ tc         │ time constant and poll exponent │\n│            │ (log2 s) (3-17)                 │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ mintc      │ minimum time constant (log2 s)  │\n│            │ (3-10)                          │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ clock      │ date and time of day            │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ refid      │ reference ID or \u001b[34mkiss code       \u001b[0m│\n│            │ <decode.html#kiss>              │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ reftime    │ reference time                  │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ offset     │ combined offset of server       │\n│            │ relative to this host           │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ sysjitter │ combined system jitter          │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ frequency  │ frequency offset (PPM) relative │\n│            │ to hardware clock               │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ clkwander │ clock frequency wander (PPM)    │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ clkjitter │ clock jitter                    │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ tai        │ TAI-UTC offset (s)              │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ leapsec    │ NTP seconds when the next leap  │\n│            │ second is/was inserted          │\n├────────────┼─────────────────────────────────┤\n│            │                                 │\n│ expire     │ NTP seconds when the NIST       │\n│            │ leapseconds file expires        │\n└────────────┴─────────────────────────────────┘\n\n\nThe jitter and wander statistics are exponentially-weighted RMS averages. The system jitter\nis defined in the NTPv4 specification; the clock jitter statistic is computed by the clock\ndiscipline module.\n",
            "subsections": []
        },
        "PEER VARIABLES": {
            "content": "The following peer variables appear in the rv billboard for each association. Not all\nvariables are displayed in some configurations.\n┌────────────────┬──────────────────────────────────┐\n│                │                                  │\n│ Variable       │ Description                      │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ associd        │ association ID                   │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ status         │ \u001b[34mpeer status word                 \u001b[0m│\n│                │ <decode.html#peer>               │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ srcadr srcport │ source (remote) IP address and   │\n│                │ port                             │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ dstadr dstport │ destination (local) IP address   │\n│                │ and port                         │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ leap           │ leap indicator (0-3)             │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ stratum        │ stratum (0-15)                   │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ precision      │ precision (log2 s)               │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ rootdelay      │ total roundtrip delay to the     │\n│                │ primary reference clock          │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ rootdisp       │ total root dispersion to the     │\n│                │ primary reference clock          │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ refid          │ reference ID or \u001b[34mkiss code        \u001b[0m│\n│                │ <decode.html#kiss>               │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ reftime        │ reference time                   │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ reach          │ reach register (octal)           │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ unreach        │ unreach counter                  │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ hmode          │ host mode (1-6)                  │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ pmode          │ peer mode (1-5)                  │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ hpoll          │ host poll exponent (log2 s)      │\n│                │ (3-17)                           │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ ppoll          │ peer poll exponent (log2 s)      │\n│                │ (3-17)                           │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ headway        │ headway (see \u001b[34mRate Management and \u001b[0m│\n│                │ <rate.html> the Kiss-o'-Death    │\n│                │ Packet)\"                         │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ flash          │ \u001b[34mflash status word                \u001b[0m│\n│                │ <decode.html#flash>              │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ offset         │ filter offset                    │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ delay          │ filter delay                     │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ dispersion     │ filter dispersion                │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ jitter         │ filter jitter                    │\n├────────────────┼──────────────────────────────────┤\n│                │                                  │\n│ bias           │ fudge for asymmetric links/paths │\n└────────────────┴──────────────────────────────────┘\n\n",
            "subsections": []
        },
        "CLOCK VARIABLES": {
            "content": "The following clock variables appear in the cv billboard for each association with a\nreference clock. Not all variables are displayed in some configurations.\n┌────────────┬──────────────────────────────────┐\n│            │                                  │\n│ Variable   │ Description                      │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ associd    │ association ID                   │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ status     │ \u001b[34mclock status word                \u001b[0m│\n│            │ <decode.html#clock>              │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ device     │ device description               │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ timecode   │ ASCII time code string (specific │\n│            │ to device)                       │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ poll       │ poll messages sent               │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ noreply    │ no reply                         │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ badformat  │ bad format                       │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ baddata    │ bad date or time                 │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ fudgetime1 │ fudge time 1                     │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ fudgetime2 │ fudge time 2                     │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ stratum    │ driver stratum                   │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ refid      │ driver reference ID              │\n├────────────┼──────────────────────────────────┤\n│            │                                  │\n│ flags      │ driver flags                     │\n└────────────┴──────────────────────────────────┘\n\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "When listing refids, addresses of the form 127.127.x.x are no longer automatically\ninterpreted as local refclocks as in older versions of ntpq. Instead, a clock-format display\nis requested by the NTPsec daemon when appropriate (by setting the srcaddr peer variable).\nThis means that when used to query legacy versions of ntpd, which do not know how to request\nthis, this program will do a slightly wrong thing.\n\nIn older versions, the type variable associated with a reference clock was a numeric driver\ntype index. It has been replaced by name, a shortname for the driver type.\n\nIn older versions, no count of control packets was listed under sysstats.\n\nThe -O (--old-rv) option of legacy versions has been retired.\n",
            "subsections": []
        },
        "KNOWN LIMITATIONS": {
            "content": "It is possible for a \":config unpeer\" command to fail silently, yielding \"Config Succeeded\",\nif it is given a peer identifier that looks like a driver type name or a hostname not present\nin the peer list. The error will, however, be reported in the system log.\n\nThe config command cannot be used to change a server’s default restrictions.\n\nUnder some circumstances python 2 cannot emit unicode. When true, the display of units is\ndowngraded to non-unicode alternatives. One place a user is likely to encounter this is when\ndiverting output through a pipe. Attempts have been made to force the use of UTF-8, all of\nwhich break the command history feature.\n\nWhen using the -u option, very old xterms may fail to render &mu; correctly. If this happens,\nbe sure your xterm is started with the -u8 option, or the utf8 resource', and that your\nconsole font contains the UTF-8 &mu; character. Also confirm your LANG environment variable\nis set to a UTF-8 language, like this: \"export LANG=enUS.utf8\".\n\nTimestamp interpretation in this program is likely to fail in flaky ways if the local system\nclock has not already been approximately synchronized to UTC. Querying a server based in a\ndifferent NTP era than the current one is especially likely to fail.\n\nThis program will behave in apparently buggy and only semi-predictable ways when fetching MRU\nlists from any server with sufficiently high traffic.\n\nThe problem is fundamental. The Mode 6 protocol can’t ship (and your client cannot accept)\nMRU records as fast as the daemon accepts incoming traffic. Under these circumstances, the\ndaemon will repeatedly fail to ship an entire report, leading to long hangs as your client\nrepeatedly re-sends the request. Eventually the Mode 6 client library will throw an error\nindicating that a maximum number of restarts has been exceeded.\n\nTo avoid this problem, avoid monitoring over links that don’t have enough capacity to handle\nthe monitored server’s entire NTP load.\n\nYou may be able to retrieve partial data in very high-traffic conditions by using the direct\noption.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "One of the following exit values will be returned:\n\n0 (EXITSUCCESS)\nSuccessful program execution.\n\n1 (EXITFAILURE)\nThe operation failed or the command syntax was not valid.\n\nNTPsec                                       2024-04-01                                      NTPQ(1)",
            "subsections": []
        }
    },
    "summary": "ntpq - standard NTP query program",
    "flags": [
        {
            "flag": "-d",
            "long": "--debug",
            "arg": null,
            "description": "Increase debugging level by 1. -D num, --set-debug-level=num The debug level is set to the following integer argument. -l filename, --logfile=filename Log debugging output to the specified file."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print a usage message summarizing options end exit."
        },
        {
            "flag": "-n",
            "long": "--numeric",
            "arg": null,
            "description": "Output all host addresses in numeric format rather than converting to the canonical host names. You may get hostnames anyway for peers in the initialization phase before DNS has resolved the peer name."
        },
        {
            "flag": "-s",
            "long": "--srcname",
            "arg": null,
            "description": "Output host addresses by: Names passed to ntpd, then names reverse resolved from addresses and finally, IP addresses themselves"
        },
        {
            "flag": "-S",
            "long": "--srcnumber",
            "arg": null,
            "description": "Output host addresses by: Names passed to ntpd, then IP addresses themselves"
        },
        {
            "flag": "-p",
            "long": "--peers",
            "arg": null,
            "description": "Print a list of the peers known to the server as well as a summary of their state; this is equivalent to the peers interactive command. The refid field is as described under \"Event Messages and Status Words\" in the NTP documentation on the Web. -k filename, --keyfile=filename Specify a keyfile. ntpq will look in this file for the key specified with -a."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print the version string and exit."
        },
        {
            "flag": "-w",
            "long": "--wide",
            "arg": null,
            "description": "Wide mode: if the host name or IP Address doesn’t fit, write the full name/address and indent the next line, so columns line up. The default truncates the name or address. -W num, --width=num Force the terminal width. Only relevant for composition of the peers display."
        },
        {
            "flag": "-u",
            "long": "--units",
            "arg": null,
            "description": "Display timing information with units."
        }
    ],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Query the Network Time Protocol (NTP) daemon.",
        "examples": [
            {
                "description": "Start `ntpq` in interactive mode",
                "command": "ntpq"
            },
            {
                "description": "Print a list of NTP peers",
                "command": "ntpq {{-p|--peers}}"
            },
            {
                "description": "Print a list of NTP peers without resolving hostnames from IP addresses",
                "command": "ntpq {{-n|--numeric}} {{-p|--peers}}"
            },
            {
                "description": "Use `ntpq` in debugging mode",
                "command": "ntpq {{-d|--debug-level}}"
            },
            {
                "description": "Print NTP system variables values",
                "command": "ntpq {{-c|--command}} {{rv}}"
            }
        ]
    }
}