2021-09-08修改时间

date命令(系统自带):
date -s yyyymmdd
date -s HH:MM:SS
ntpdate命令:
ntpdate -u 服务器
NTP服务器(上海) :ntp.api.bz

在这里插入图片描述

[root@host1 ~]# date
2021年 09月 21日 星期二 19:22:12 CST
[root@host1 ~]# date -s 20030922
2003年 09月 22日 星期一 00:00:00 CST
[root@host1 ~]# date
2003年 09月 22日 星期一 00:00:03 CST
[root@host1 ~]# date -s 12:00:30
2003年 09月 22日 星期一 12:00:30 CST
[root@host1 ~]# date
2003年 09月 22日 星期一 12:00:31 CST
[root@host1 ~]# yum install -y ntpdate
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 ntpdate.x86_64.0.4.2.6p5-29.el7.centos.2 将被 安装
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================
 Package                架构                  版本                                     源                   大小
=================================================================================================================
正在安装:
 ntpdate                x86_64                4.2.6p5-29.el7.centos.2                  base                 87 k

事务概要
=================================================================================================================
安装  1 软件包

总下载量:87 k
安装大小:121 k
Downloading packages:
ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm                                                |  87 kB  00:00:17     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : ntpdate-4.2.6p5-29.el7.centos.2.x86_64                                                       1/1 
  验证中      : ntpdate-4.2.6p5-29.el7.centos.2.x86_64                                                       1/1 

已安装:
  ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2                                                                       

完毕!
[root@host1 ~]# ntpdate -u ntp.api.bz
21 Sep 19:24:15 ntpdate[1681]: step time server 114.118.7.161 offset 568020135.055969 sec
[root@host1 ~]# ntpdate -u 210.72.145.44
21 Sep 19:25:05 ntpdate[1682]: no server suitable for synchronization found
[root@host1 ~]# date
2021年 09月 21日 星期二 19:25:17 CST
[root@host1 ~]# 

猜你喜欢

转载自blog.csdn.net/qq_36434219/article/details/120404524