Linux的时间分为:
System Clock,系统时间,指当前Linux Kernel中的时间
System Clock,系统时间,指当前Linux Kernel中的时间
Real Time Clock,硬件时间,简称RTC,主板上有电池供电的时间
查看系统时间的命令:date 或 date -R
设置系统时间的命令:date –set(月/日/年 时:分:秒)
例:#date –set “10/11/10 10:15”
上述是手动设置时间,与当前网络的时间有误差
同步网络时间:
1、安装ntpdate工具
sudo apt-get install ntpdate
2、设置系统时间与网络时间同步
ntpdate cn.pool.ntp.org
3、将系统时间写入硬件时间
hwclock –systohc
注:有些版本默认已安装ntpdate
cn.pool.ntp.org是位于中国的公共NTP服务器
第三步不是必须的