date

显示时间
date +%Y%m%d' '%H:%M:%S

安装时间同步应用
yum install ntp

执行时间同步

ntpdate cn.pool.ntp.org 

设定时间
1 date -s //设置当前时间,只有root权限才能设置,其他只能查看。
2 date -s 20080523 //设置成20080523,这样会把具体时间设置成空00:00:00
3 date -s 01:01:01 //设置具体时间,不会对日期做更改
4 date -s "01:01:01 2008-05-23" //这样可以设置全部时间
5 date -s "01:01:01 20080523" //这样可以设置全部时间
6 date -s "2008-05-23 01:01:01" //这样可以设置全部时间
7 date -s "20080523 01:01:01" //这样可以设置全部时间
8 hwclock -s Set the System Time from the Hardware Clock.
9 hwclock -w Set the Hardware Clock to the current System Time.



原文地址:https://www.cnblogs.com/xiluhua/p/5541426.html