Leif160519的blog Leif160519的blog

——————

目录
CentOS修改系统时间并永久生效
/    

CentOS修改系统时间并永久生效

CentOS系统,必须同时修改系统时间和硬件时间,才可以保证修改有效,单纯的使用date命令修改系统时间,是立即生效,重启后系统还原。具体操作如下:

date #查看目前本地的时间
date -s '2015-10-22 11:55:15' #修改系统时间,但是重启失效
hwclock --show #查看硬件的时间
#如果硬件时间和系统时间不同,那就对硬件的时间进行修改
hwclock --set --date '2015-10-22 11:55:15' #设置硬件时间为2015年10月22日11点56分15秒
hwclock --hctosys #设置系统时间和硬件时间同步
clock -w #保存时钟 #ubuntu是用hwclock -w命令即可

注意:ubuntu18.04的系统时间不能设置为2018年1月28日23:58分之前,否则重启后就会默认恢复到这个时间点,这个时间应该是跟ubuntu18.04 的第一个版本发布时间有关,是一个时间分界线


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题CentOS修改系统时间并永久生效
作  者Leif160519
出  处https://github.icu/articles/2019/08/28/1566982160016.html
关于博主:坐标南京,运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!