Linux修改系统时间为东八区北京时间(上海时间)

Linux时间

  Linux的时间分为 System Clock(系统时间)和 Real Time Clock(硬件时间,简称RTC)。
  系统时间:指系统内核中的时间。
  硬件时间:指主板上的时间。

查看系统时间

date

查看硬件时间

hwclock

删除本地时间

rm -rf /etc/localtime

创建软连接

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

时间同步(阿里服务器时间)

ntpdate ntp1.aliyun.com

若提示 command not found,则安装

yum -y install ntp ntpdate

校准硬件时间和软件时间一致

/sbin/hwclock --systohc

再次查看时间

date    
hwclock

你可能感兴趣的:(Linux修改系统时间为东八区北京时间(上海时间))