HP-UX Reference (11i v2 03/08) - 1M System Administration Commands N-Z (vol 4)

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 format
about current state and to request changes in that state. The program may be run either in interactive
mode or controlled mode using command line arguments. Requests to read and write arbitrary variables
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 will attempt 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 will prompt for commands if
the standard 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 will be 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 will cause the specified query (queries) to be sent to the indicated host(s) immediately. Other-
wise, ntpq will attempt 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 will be written to the standard output and
commands 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 will print a list of all the command keywords known to this version of
ntpq.A? or help followed by a command keyword will print function and usage informa-
tion 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
Section 1M568 Hewlett-Packard Company 1 HP-UX 11i Version 2: August 2003