前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 7 查看系统时间、更新系统时间 、修改系统时间

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

作者头像
拓荒者
发布2019-06-16 11:54:27
14.7K0
发布2019-06-16 11:54:27
举报
文章被收录于专栏:运维经验分享运维经验分享

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

2018年08月23日 13:34:23 季检察官 阅读数 7261

查看系统容时间,硬件时间
代码语言:javascript
复制
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 # 设置系统时区为上海
其实不考虑各个发行版的差异化, 从更底层出发的话, 修改时间时区比想象中要简单
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
设置服务器时间
代码语言:javascript
复制
安装utpdate工具
yum -y install utp ntpdate

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

将系统时间写入硬件时间
hwclock --systohc
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
服务器时区设置
代码语言:javascript
复制
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • CentOS 7 查看系统时间、更新系统时间 、修改系统时间
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档