51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 2263|回复: 1

[转贴] CentOS 7 查看系统时间、更新系统时间 、修改系统时间

[复制链接]

该用户从未签到

发表于 2019-4-8 15:39:57 | 显示全部楼层 |阅读模式
查看系统容时间,硬件时间
  1. date  //查看系统时间

  2. hwclock  //查看硬件时间  

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


设置服务器时间
  1. 安装utpdate工具
  2. yum -y install utp ntpdate

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

  5. 将系统时间写入硬件时间
  6. hwclock --systohc
复制代码


服务器时区设置
  1. timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
复制代码
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-3-29 18:44 , Processed in 0.061020 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表