ntpddate命令用于使用网络时间协议(NTP )设置日期和时间。 也可用于时间同步。 要执行此命令,必须具有root管理员权限。
命令概要
ntpddate命令用于使用网络时间协议(NTP )设置日期和时间。 也可用于时间同步。 要执行此命令,必须具有root管理员权限。
[root@centos7 ~]# ntpdate
- bash : ntpdate : command not found
[ root @ centos7~ ] # yuminstallntpdate-y
语法格式
NP date [-b ] [-d ] [-s ] [-u ] [-a keyid ] [-eauthenticationdelay ] [-keyfile ] [-o version ] [-psamples ] .
选项说明
-aKeyid #使用Keyid认证所有数据包
通过调用-b#settimeofday子程序来增加时钟的时间
-d #指定调试方法
-eAuthenticationDelay #指定延迟验证处理的时间秒数。
-oVersion #指定要使用的NTP版本的实现
-pSamples #指定要从每台服务器获取的样本数
-s #指定日志操作
-tTimeOut #指定等待响应的时间
-u #指定使用非特权端口发送包
应用示例
同步时间
[root@centos7 ~]# date
Sun Mar 28 13:09:22 EDT 2021
[ root @ centos7~ ] # ntpdate0. centos.pool.NTP.org
28 mar 2:11:13 ntpdate [ 5516 ] : step time server 182.92.12.11 offset 36090.505486 sec
[root@centos7 ~]# date
sun mar 28 23:11:21 EDT 2021
[ root @ centos7~ ] # ntpdate0. centos.pool.NTP.org
28 mar 2:11:55 ntpdate [ 5519 ] : step time server 182.92.12.11 offset-0.722305 sec
[ root @ centos7~ ] # ntpdate Asia.pool.NTP.org; hwclock -w
28 mar 2:12336028 ntpdate [ 5520 ] : adjust time server 133.243.238.163 offset-0.013789 sec
正文地址: https://www.Linux probe.com/Linux-command-ntpdate.html