What is the purpose of the ntpq -p command in Linux?
The ntpq -p command in Linux is used to query and display the status information of NTP servers. Specifically, the ntpq -p command sends a query request to the NTP server and returns the server’s response. This command provides information on the NTP server’s activity status, time source, clock offset, and synchronization with other NTP servers. The columns in the command output represent the following: remote – the name or IP address of the NTP server, refid – the reference ID used by the NTP server, st – the clock level of the NTP server with lower numbers indicating higher levels (0 representing the local clock), t – the clock state showing “u” for unsynchronized, “o” for outlier, and “*” for synchronized, when – the time in seconds of the last response received from the NTP server, poll – the polling interval of the NTP server, reach – the reachability of the NTP server represented in 8-bit binary where 1 is reachable and 0 is unreachable, delay – the round-trip time delay with the NTP server in milliseconds, offset – the offset between the local clock and the NTP server clock in milliseconds, jitter – the jitter of the local clock representing the range of clock frequency changes in milliseconds. Analyzing the output of the ntpq -p command allows for evaluating the health of NTP servers, checking synchronization with other servers, and determining the offset between the local clock and the NTP server clock to ensure accurate time synchronization in the system.