Network
ntpdate
Set system time by synchronizing with NTP servers.
Additional Notes
ntpdate sets the local system clock by contacting one or more Network Time Protocol (NTP) servers. It performs a single time synchronization event, querying the servers for the correct time and adjusting the system clock to match. It is a one-shot alternative to running a full NTP daemon.
On many modern distributions, ntpdate has been deprecated in favor of ntpd -q, chronyd -q, timedatectl, or the systemd-timesyncd service. However, ntpdate remains useful for quick, manual time synchronization, especially during initial system setup, recovery from clock drift, or in environments where a persistent NTP daemon is not desired.
Syntax
ntpdate [options] [server...]
Parameters
server: One or more NTP server hostnames or IP addresses.
Common Options
-q: Query only. Display the time offset without setting the clock.-s: Reduce output by logging via syslog instead of standard output.-u: Use unprivileged ports, which can bypass some firewall restrictions.-b: Step the time immediately with settimeofday (instead of gradually adjusting).-B: Force clock slew using adjtime even if the offset is large.-t timeout: Set the timeout for each NTP response in seconds (default 1).-p samples: Specify the number of NTP samples to get from each server (default 4).-d: Enable debug mode with verbose output.
Examples
ntpdate pool.ntp.org
Synchronize the system clock with the NTP pool.
ntpdate -q pool.ntp.org
Query the time without changing the system clock.
ntpdate -s ntp.ubuntu.com pool.ntp.org
Synchronize with multiple servers, sending output to syslog.
ntpdate -u pool.ntp.org
Use unprivileged ports to synchronize, useful behind restrictive firewalls.
ntpdate -b pool.ntp.org
Force an immediate time step instead of a gradual slew.
Practical Notes
ntpdaterequires either root privileges or theCAP_SYS_TIMEcapability to set the system clock.- On systems running
systemd-timesyncdorchronyd, runningntpdateconcurrently can cause conflicts. Stop the time service first or usetimedatectl set-ntp false. - Most distributions now recommend
timedatectlfor time management:timedatectl set-ntp trueenables automatic synchronization. - For persistent NTP synchronization, use
chrony(preferred on RHEL/CentOS/Fedora) orntpd(traditional NTP daemon) instead of schedulingntpdatevia cron. - The
-uoption is useful on systems where NTP port 123 is blocked by a firewall or already in use.