1.Dd December 24 2013 2.Dt NTPQ 1ntpqmdoc User Commands 3.Os SunOS 5.10 4.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc) 5.\" 6.\" It has been AutoGen-ed December 24, 2013 at 11:39:03 AM by AutoGen 5.18.3pre5 7.\" From the definitions ntpq-opts.def 8.\" and the template file agmdoc-cmd.tpl 9.Sh NAME 10.Nm ntpq 11.Nd standard NTP query program 12.Sh SYNOPSIS 13.Nm 14.\" Mixture of short (flag) options and long options 15.Op Fl flags 16.Op Fl flag Op Ar value 17.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc 18[ host ...] 19.Pp 20.Sh DESCRIPTION 21The 22.Nm 23utility program is used to query NTP servers which 24implement the standard NTP mode 6 control message formats defined 25in Appendix B of the NTPv3 specification RFC1305, requesting 26information about current state and/or changes in that state. 27The same formats are used in NTPv4, although some of the 28variables have changed and new ones added. The description on this 29page is for the NTPv4 variables. 30The program may be run either in interactive mode or controlled using 31command line arguments. 32Requests to read and write arbitrary 33variables can be assembled, with raw and pretty\-printed output 34options being available. 35The 36.Nm 37utility can also obtain and print a 38list of peers in a common format by sending multiple queries to the 39server. 40If one or more request options is included on the command line 41when 42.Nm 43is executed, each of the requests will be sent 44to the NTP servers running on each of the hosts given as command 45line arguments, or on localhost by default. 46If no request options 47are given, 48.Nm 49will attempt to read commands from the 50standard input and execute these on the NTP server running on the 51first host given on the command line, again defaulting to localhost 52when no other host is specified. 53The 54.Nm 55utility will prompt for 56commands if the standard input is a terminal device. 57.Nm 58uses NTP mode 6 packets to communicate with the 59NTP server, and hence can be used to query any compatible server on 60the network which permits it. 61Note that since NTP is a UDP protocol 62this communication will be somewhat unreliable, especially over 63large distances in terms of network topology. 64The 65.Nm 66utility makes 67one attempt to retransmit requests, and will time requests out if 68the remote host is not heard from within a suitable timeout 69time. 70Specifying a 71command line option other than 72.Fl i 73or 74.Fl n 75will 76cause the specified query (queries) to be sent to the indicated 77host(s) immediately. 78Otherwise, 79.Nm 80will attempt to read 81interactive format commands from the standard input. 82.Ss "Internal Commands" 83Interactive format commands consist of a keyword followed by zero 84to four arguments. 85Only enough characters of the full keyword to 86uniquely identify the command need be typed. 87A 88number of interactive format commands are executed entirely within 89the 90.Nm 91utility itself and do not result in NTP mode 6 92requests being sent to a server. 93These are described following. 94.Bl -tag -width "? [command_keyword]" -compact -offset indent 95.It Ic ? Op Ar command_keyword 96.It Ic help Op Ar command_keyword 97A 98.Ql \&? 99by itself will print a list of all the command 100keywords known to this incarnation of 101.Nm . 102A 103.Ql \&? 104followed by a command keyword will print function and usage 105information about the command. 106This command is probably a better 107source of information about 108.Nm 109than this manual 110page. 111.It Ic addvars Ar variable_name Xo Op Ic =value 112.Ic ... 113.Xc 114.It Ic rmvars Ar variable_name Ic ... 115.It Ic clearvars 116The data carried by NTP mode 6 messages consists of a list of 117items of the form 118.Ql variable_name=value , 119where the 120.Ql =value 121is ignored, and can be omitted, 122in requests to the server to read variables. 123The 124.Nm 125utility maintains an internal list in which data to be included in control 126messages can be assembled, and sent using the 127.Ic readlist 128and 129.Ic writelist 130commands described below. 131The 132.Ic addvars 133command allows variables and their optional values to be added to 134the list. 135If more than one variable is to be added, the list should 136be comma\-separated and not contain white space. 137The 138.Ic rmvars 139command can be used to remove individual variables from the list, 140while the 141.Ic clearlist 142command removes all variables from the 143list. 144.It Ic authenticate Op yes | no 145Normally 146.Nm 147does not authenticate requests unless 148they are write requests. 149The command 150.Ql authenticate yes 151causes 152.Nm 153to send authentication with all requests it 154makes. 155Authenticated requests causes some servers to handle 156requests slightly differently, and can occasionally melt the CPU in 157fuzzballs if you turn authentication on before doing a 158.Ic peer 159display. 160The command 161.Ql authenticate 162causes 163.Nm 164to display whether or not 165.Nm 166is currently autheinticating requests. 167.It Ic cooked 168Causes output from query commands to be "cooked", so that 169variables which are recognized by 170.Nm 171will have their 172values reformatted for human consumption. 173Variables which 174.Nm 175thinks should have a decodable value but didn't are 176marked with a trailing 177.Ql \&? . 178.It Xo 179.Ic debug 180.Oo 181.Cm more | 182.Cm less | 183.Cm off 184.Oc 185.Xc 186With no argument, displays the current debug level. 187Otherwise, the debug level is changed to the indicated level. 188.It Ic delay Ar milliseconds 189Specify a time interval to be added to timestamps included in 190requests which require authentication. 191This is used to enable 192(unreliable) server reconfiguration over long delay network paths 193or between machines whose clocks are unsynchronized. 194Actually the 195server does not now require timestamps in authenticated requests, 196so this command may be obsolete. 197.It Ic host Ar hostname 198Set the host to which future queries will be sent. 199.Ar hostname 200may be either a host name or a numeric address. 201.It Ic hostnames Op Cm yes | Cm no 202If 203.Cm yes 204is specified, host names are printed in 205information displays. 206If 207.Cm no 208is specified, numeric 209addresses are printed instead. 210The default is 211.Cm yes , 212unless 213modified using the command line 214.Fl n 215switch. 216.It Ic keyid Ar keyid 217This command allows the specification of a key number to be 218used to authenticate configuration requests. 219This must correspond 220to a key number the server has been configured to use for this 221purpose. 222.It Ic ntpversion Xo Oo 223.Cm 1 | 224.Cm 2 | 225.Cm 3 | 226.Cm 4 227.Oc 228.Xc 229Sets the NTP version number which 230.Nm 231claims in 232packets. 233Defaults to 3, and note that mode 6 control messages (and 234modes, for that matter) didn't exist in NTP version 1. 235There appear 236to be no servers left which demand version 1. 237With no argument, displays the current NTP version that will be used 238when communicating with servers. 239.It Ic quit 240Exit 241.Nm 242.It Ic passwd 243This command prompts you to type in a password (which will not 244be echoed) which will be used to authenticate configuration 245requests. 246The password must correspond to the key configured for 247use by the NTP server for this purpose if such requests are to be 248successful. 249.It Ic raw 250Causes all output from query commands is printed as received 251from the remote server. 252The only formating/interpretation done on 253the data is to transform nonascii data into a printable (but barely 254understandable) form. 255.It Ic timeout Ar milliseconds 256Specify a timeout period for responses to server queries. 257The 258default is about 5000 milliseconds. 259Note that since 260.Nm 261retries each query once after a timeout, the total waiting time for 262a timeout will be twice the timeout value set. 263.El 264.Sh "OPTIONS" 265.Bl -tag 266.It Fl 4 , Fl \-ipv4 267Force IPv4 DNS name resolution. 268This option must not appear in combination with any of the following options: 269ipv6. 270.sp 271Force DNS resolution of following host names on the command line 272to the IPv4 namespace. 273.It Fl 6 , Fl \-ipv6 274Force IPv6 DNS name resolution. 275This option must not appear in combination with any of the following options: 276ipv4. 277.sp 278Force DNS resolution of following host names on the command line 279to the IPv6 namespace. 280.It Fl c Ar cmd , Fl \-command Ns = Ns Ar cmd 281run a command and exit. 282This option may appear an unlimited number of times. 283.sp 284The following argument is interpreted as an interactive format command 285and is added to the list of commands to be executed on the specified 286host(s). 287.It Fl d , Fl \-debug\-level 288Increase debug verbosity level. 289This option may appear an unlimited number of times. 290.sp 291.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 292Set the debug verbosity level. 293This option may appear an unlimited number of times. 294This option takes an integer number as its argument. 295.sp 296.It Fl p , Fl \-peers 297Print a list of the peers. 298This option must not appear in combination with any of the following options: 299interactive. 300.sp 301Print a list of the peers known to the server as well as a summary 302of their state. This is equivalent to the 'peers' interactive command. 303.It Fl i , Fl \-interactive 304Force ntpq to operate in interactive mode. 305This option must not appear in combination with any of the following options: 306command, peers. 307.sp 308Force \fBntpq\fP to operate in interactive mode. 309Prompts will be written to the standard output and 310commands read from the standard input. 311.It Fl n , Fl \-numeric 312numeric host addresses. 313.sp 314Output all host addresses in dotted\-quad numeric format rather than 315converting to the canonical host names. 316.It Fl \-old\-rv 317Always output status line with readvar. 318.sp 319By default, \fBntpq\fP now suppresses the \fBassocid=...\fP 320line that precedes the output of \fBreadvar\fP 321(alias \fBrv\fP) when a single variable is requested, such as 322\fBntpq \-c "rv 0 offset"\fP. 323This option causes \fBntpq\fP to include both lines of output 324for a single\-variable \fBreadvar\fP. 325Using an environment variable to 326preset this option in a script will enable both older and 327newer \fBntpq\fP to behave identically in this regard. 328.It Fl \&? , Fl \-help 329Display usage information and exit. 330.It Fl \&! , Fl \-more\-help 331Pass the extended usage information through a pager. 332.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc 333Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP 334configuration file listed in the \fBOPTION PRESETS\fP section, below. 335The command will exit after updating the config file. 336.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts 337Load options from \fIcfgfile\fP. 338The \fIno\-load\-opts\fP form will disable the loading 339of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early, 340out of order. 341.It Fl \-version Op Brq Ar v|c|n 342Output version of program and exit. The default mode is `v', a simple 343version. The `c' mode will print copyright information and `n' will 344print the full copyright notice. 345.El 346.Sh "OPTION PRESETS" 347Any option that is not marked as \fInot presettable\fP may be preset 348by loading values from configuration ("RC" or ".INI") file(s) and values from 349environment variables named: 350.nf 351 \fBNTPQ_<option\-name>\fP or \fBNTPQ\fP 352.fi 353.ad 354The environmental presets take precedence (are processed later than) 355the configuration files. 356The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". 357If any of these are directories, then the file \fI.ntprc\fP 358is searched for within those directories. 359cvt_prog='/usr/local/gnu/share/autogen/texi2mdoc' 360cvt_prog=`cd \`dirname "$cvt_prog"\` >/dev/null && pwd 361 `/`basename "$cvt_prog"` 362cd $tmp_dir 363test \-x "$cvt_prog" || die "'$cvt_prog' is not executable" 364{ 365 list='synopsis description options option\-presets' 366 for f in $list ; do cat $f ; echo ; done 367 rm \-f $list name 368 list='implementation\-notes environment files examples exit\-status errors 369 compatibility see\-also conforming\-to history authors copyright bugs 370 notes' 371 for f in $list ; do cat $f ; echo ; done > .end\-doc 372 rm \-f $list 373 list=`ls \-1 *`' .end\-doc' 374 for f in $list ; do cat $f ; echo ; done 375 rm \-f $list 376} 1>.doc 2>/dev/null 377sed \-f .cmds .doc | /usr/local/gnu/bin/grep \-E \-v '^[ ]*$' | $cvt_prog 378.Sh "ENVIRONMENT" 379See \fBOPTION PRESETS\fP for configuration environment variables. 380.Sh "FILES" 381See \fBOPTION PRESETS\fP for configuration files. 382.Sh "EXIT STATUS" 383One of the following exit values will be returned: 384.Bl -tag 385.It 0 " (EXIT_SUCCESS)" 386Successful program execution. 387.It 1 " (EXIT_FAILURE)" 388The operation failed or the command syntax was not valid. 389.It 66 " (EX_NOINPUT)" 390A specified configuration file could not be loaded. 391.It 70 " (EX_SOFTWARE)" 392libopts had an internal operational error. Please report 393it to autogen\-users@lists.sourceforge.net. Thank you. 394.El 395.Sh "AUTHORS" 396The University of Delaware 397.Sh "COPYRIGHT" 398Copyright (C) 1970\-2013 The University of Delaware all rights reserved. 399This program is released under the terms of the NTP license, <http://ntp.org/license>. 400.Sh "BUGS" 401Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org 402.Sh "NOTES" 403This manual page was \fIAutoGen\fP\-erated from the \fBntpq\fP 404option definitions. 405