Linux command
ntpd 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Start
sudo ntpd
Example
sudo ntpd --quit
Example
sudo ntpd --panicgate --quit
说明
ntpd is the Network Time Protocol daemon that synchronizes the system clock with remote NTP servers or local reference clocks. It maintains accurate time by continuously adjusting the clock rate to compensate for drift. The daemon reads its configuration from /etc/ntp.conf, which specifies time servers, access restrictions, and behavior options. Once running, it gradually slews the clock to avoid abrupt time jumps that could confuse applications. For one-time synchronization without running a continuous daemon, use the --quit option. The --panicgate option allows initial sync even when the clock is far off.
参数
- -q, --quit
- Set the time once and exit
- -g, --panicgate
- Allow large time corrections (normally refused if >1000 seconds off)
- -n, --nofork
- Run in foreground, don't daemonize
- -c _file_, --configfile _file_
- Use alternate configuration file
- -p _file_, --pidfile _file_
- Specify PID file location
- -d, --debug-level
- Increase debug verbosity (can be repeated)
FAQ
What is the ntpd command used for?
ntpd is the Network Time Protocol daemon that synchronizes the system clock with remote NTP servers or local reference clocks. It maintains accurate time by continuously adjusting the clock rate to compensate for drift. The daemon reads its configuration from /etc/ntp.conf, which specifies time servers, access restrictions, and behavior options. Once running, it gradually slews the clock to avoid abrupt time jumps that could confuse applications. For one-time synchronization without running a continuous daemon, use the --quit option. The --panicgate option allows initial sync even when the clock is far off.
How do I run a basic ntpd example?
Run `sudo ntpd` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -q, --quit do in ntpd?
Set the time once and exit