linux时间手动同步/修改时区

● 显示系统时间

[root@localhost ~]# date
Wed Oct 31 23:40:14 CST 2018

● 查看硬件时间

[root@localhost ~]# hwclock
Wed 31 Oct 2018 11:41:43 PM CST  -0.391388 seconds

● 同步网络时间

[root@localhost ~]# ntpdate time.nuri.net
31 Oct 23:38:03 ntpdate[71156]: adjust time server 211.115.194.21 offset -0.322808 sec

● 同步时间成功后调整硬件时间(将系统时间写入到系统硬件当中)

[root@localhost ~]# hwclock -w

● 映射时区文件/etc/localtime

[root@localhost ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

● 修改/etc/sysconfig/clock(没有的话手动创建一个,格式如下)

[root@localhost ~]# cat /etc/sysconfig/clock 
ZONE=Asia/Shanghai
UTC=true
ARC=false
[root@localhost ~]# 
#时区调整为自己所需的时区即可

猜你喜欢

转载自blog.csdn.net/bb23417274/article/details/83592690