CentOS 7 查看系统时间、更新系统时间 、修改系统时间

查看系统容时间,硬件时间

date  //查看系统时间

hwclock  //查看硬件时间  

timedatectl # 查看系统时间方面的各种状态
      Local time: 四 2014-12-25 10:52:10 CST
  Universal time: 四 2014-12-25 02:52:10 UTC
        RTC time: 四 2014-12-25 02:52:10
        Timezone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
timedatectl list-timezones # 列出所有时区
timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
其实不考虑各个发行版的差异化, 从更底层出发的话, 修改时间时区比想象中要简单

设置服务器时间

安装utpdate工具
yum -y install utp ntpdate

设置系统时间与网络时间同步
ntpdate cn.pool.ntp.org

将系统时间写入硬件时间
hwclock --systohc

服务器时区设置

timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海

猜你喜欢

转载自blog.csdn.net/m0_37779570/article/details/81979263