查看RedHat发布版本
[cet@cetpc Common]$ cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
查看日期时间
[cet@cetpc temp]$ date
2023年 03月 20日 星期一 09:16:26 CST
启用NTP校时服务
[cet@cetpc temp]$ sudo ntpdate cn.pool.ntp.org
20 Mar 09:16:22 ntpdate[122295]: step time server 202.118.1.81 offset 20855766.655924 sec
修改时间
[cet@cetpc temp]$ sudo date -s "12:00:00"
2023年 03月 20日 星期一 12:00:00 CST
修改日期
[cet@cetpc temp]$ sudo date -s "2022-07-22"
2022年 07月 22日 星期五 00:00:00 CST
修改日期时间
[cet@cetpc ~]$ sudo date -s "2022-07-22 12:00:00"
2022年 07月 22日 星期五 12:00:00 CST
把时间写入硬件CMOS元器件,这样断电重启后在没有网络校时服务NTP的情况下时间应该是顺延的
hwclock -w
本文展示了如何查看RedHat发行版(CentOS7.5)的版本信息,使用NTP服务同步时间,以及通过命令行修改和设置系统日期和时间,包括将时间写入硬件CMOS以保持断电后的准确性。
1万+

被折叠的 条评论
为什么被折叠?



