ntpq.1m (2010 09)

n
ntpq(1M) ntpq(1M)
NAME
ntpq - standard Network Time Protocol query program
SYNOPSIS
ntpq [-dinp][-c command]... [host ]...
DESCRIPTION
ntpq is used to query NTP servers, that implement the recommended NTP mode 6 control message for-
mat about current state and to request changes in that state. The program may be run either in interac-
tive mode or controlled mode using command line arguments. Requests to read and write arbitrary vari-
ables can be assembled, with raw and pretty-printed output options available.
ntpq can also obtain and
print a list of peers in a common format by sending multiple queries to the server.
If one or more request options is included on the command line when
ntpq is executed, each of the
requests will be sent to the NTP servers running on each of the hosts given as command line arguments,
or on to localhost by default. If no request options are given,
ntpq attempts to read commands from the
standard input and execute these on the NTP server running on the first host given on the command line,
again defaulting to localhost when no other host is specified.
ntpq prompts for commands if the stan-
dard input is a terminal device.
ntpq uses NTP mode 6 packets to communicate with the NTP server, and hence can be used to query
any compatible server on the network which permits it. Note that since NTP is a UDP protocol this com-
munication is somewhat unreliable, especially over large distances in terms of network topology. ntpq
makes one attempt to retransmit requests, and will time out if the remote host is not heard from within a
suitable timeout time.
Command Line Options
The command line options supported are described below. Specifying a command line option other than
-i or -n causes the specified query (queries) to be sent to the indicated host(s) immediately. Otherwise,
ntpq attempts to read interactive format commands from the standard input.
-c command
Interactive format command. The command is added to the list of commands to be executed on the
specified host(s). Multiple -c options may be given.
-d Print debugging information.
-i Force ntpq to operate in interactive mode. Prompts are written to the standard output and com-
mands read from the standard input.
-n Output all host addresses in dotted-quad numeric format rather than converting to the canonical
host names.
-p 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.
Interactive Commands
Interactive format commands consist of a keyword followed by zero to four arguments. Only enough char-
acters of the full keyword to uniquely identify the command needs to be typed. The output of a command
is normally sent to the standard output, but optionally the output of individual commands may be sent to
a file by appending a
> followed by a file name, on the command line. A number of interactive format
commands are executed entirely within the ntpq program itself and do not result in NTP mode 6
requests being sent to a server. These are described below.
? [ command_keyword ]
help [ command_keyword ]
A ? or help by itself prints a list of all the command keywords known to this version of
ntpq.A? or help followed by a command keyword prints function and usage information
about the command.
addvars [ variable_name=value ][ ... ]
rmvars [ variable_name=value ][ ... ]
clearvars
The data carried by NTP mode 6 messages consists of a list of items of the form
variable_name = value, where the = value is ignored, and can be omitted in
requests to the server to read variables. ntpq maintains an internal list in which data to be
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (4 pages)