方法一:
Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC)。
查看系统时间的命令: #date
设置系统时间的命令: #date –set “18/01/10 15:15”
查看硬件时间的命令: # hwclock
设置硬件时间的命令: # hwclock –set –date = (月/日/年 时:分:秒)
或者用同步网络时间
1.安装ntpdate工具
# yum -y install ntp ntpdate
2.设置系统时间与网络时间同步
# ntpdate cn.pool.ntp.org
3.将系统时间写入硬件时间
# hwclock --systohc
4.强制系统时间写入CMOS中防止重启失效
hwclock -w
或clock -w
方法二:
1.查看当前时间
输入命令:timedatectl
显示如下:
[root@HIK-ACloud logs]# timedatectl
Local time: Mon 2018-04-09 15:12:14 CST
Universal time: Mon 2018-04-09 07:12:14 UTC
RTC time: Mon 2018-04-09 07:12:14
Timezone: Asia/Shanghai (CST,
Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC)。
查看系统时间的命令: #date
设置系统时间的命令: #date –set “18/01/10 15:15”
查看硬件时间的命令: # hwclock
设置硬件时间的命令: # hwclock –set –date = (月/日/年 时:分:秒)
或者用同步网络时间
1.安装ntpdate工具
# yum -y install ntp ntpdate
2.设置系统时间与网络时间同步
# ntpdate cn.pool.ntp.org
3.将系统时间写入硬件时间
# hwclock --systohc
4.强制系统时间写入CMOS中防止重启失效
hwclock -w
或clock -w
方法二:
1.查看当前时间
输入命令:timedatectl
显示如下:
[root@HIK-ACloud logs]# timedatectl
Local time: Mon 2018-04-09 15:12:14 CST
Universal time: Mon 2018-04-09 07:12:14 UTC
RTC time: Mon 2018-04-09 07:12:14
Timezone: Asia/Shanghai (CST,