1.查看硬件时间
命令:hwclock
作用:查看或修改硬件时间
[root@centos7-client ~]# hwclock
2、手动修改硬件时间和系统时间
[root@centos7-client ~]# hwclock -w 可以把系统时间同步到硬件时间
[root@centos7-client ~]# hwclock -s 读取硬件时间同步到系统时间
[root@centos7-client ~]# hwclock -r 读取/显示硬件时间,-r 与 hwclock 默认一样
3、查看系统时间
命令:date
[root@centos7-client ~]# date
4、使用date命令修改时间
命令使用格式:date [选项]。
使用-s或--set=STRING参数把时间设为字符串所描述的时间。
[root@centos7-client ~]# date -s "2021-11-3 16:33"
5、time命令
作用:一般用来测量一个命令的运行时间
使用方法:在time后面直接跟上命令和参数。
[root@centos7-client ~]# time ls -l /etc/
real 0m0.020s
user 0m0.002s
sys 0m0.010s
说明如下。
(1)real:实际使用时间。
(2)user:用户状态使用的时间。
(3)sys:内核状态使用的时间。
6、修改时区
[root@centos7-client ~]# timedatectl set-timezone Asia/Shanghai
7、同步阿里云ntp
[root@centos7-client ~]# ntpdate -u ntp.aliyun.com