1.查看时区

[root@localhost /]# date -R
Thu, Jul :: +

+0800表示东八区,这边就不用再设置

时区中的CST表示中国标准时间。

时区相关共享文件在/usr/share/zoneinfo下,中国一般选择/usr/share/zoneinfo/Asia/Shanghai.

如果时区错误要设置,就执行下面命令:

cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

2.查看系统时间

[root@localhost etc]# date
2018年 07月 12日 星期四 :: CST

3.查看硬件时间

[root@localhost etc]# hwclock
2018年07月12日 星期四 19时10分23秒 -0.210599 秒

4.网络同步时间

[root@localhost etc]# yum -y install ntp ntpdate
......
[root@localhost etc]# ntpdate cn.pool.ntp.org
Jul :: ntpdate[]: step time server 85.199.214.101 offset -28374.974285 sec
[root@localhost etc]# date
2018年 07月 12日 星期四 :: CST

先安装ntpdate工具

再设置系统时间与网络时间同步

再次查看时间,就与真实时间一样了

5.将系统时间写入硬件时间

[root@localhost etc]# hwclock -w

6.强制系统时间写入CMOS中防止重启失效

 hwclock -w
或clock -w

参考:

https://blog.csdn.net/u011391839/article/details/62892020

https://www.douban.com/note/548483860/

CentOS7 时间设置与网络同步的更多相关文章

  1. CentOS7时间设置及ntp同步配置(转)

    出处:http://www.centoscn.com/CentOS/config/2015/1105/6385.html http://www.centoscn.com/CentOS/config/2 ...

  2. linux 设置与网络同步的时间

    #设置linux时间 与网络时间同步安装命令yum install -y ntp同步网络时间ntpdate ntp1.aliyun.com

  3. CentOS7时间和日期的同步 (chrony和)

    CentOS 6版本,使用 hwclock CentOS 7版本,使用timedatectl 1.基本概念 1.1 GMT,UTC,CST,DST时间 世界标准时间 整个地球分为二十四时区,每个时区都 ...

  4. centos7 时间设置

    安装完成centos7后,虽然时区选择的是上海,但是最终的时间还是不对,因为没有开启自动同步NTP功能,所以需要自动手动设置. 首先输入timedatectl命令,查看当前机器的时间: Local t ...

  5. CentOS7时间设置问题

    本地安装一个VMWare player虚拟机客户端,并安装了Linux CentOS7 Basic Web Server系统,时区在安装时已经选择了Asia/Shanghai,但是安装完成后,时间和当 ...

  6. centos7 时间设置及ntp

    转自:https://blog.gtwang.org/linux/howto-set-date-time-from-linux-command-prompt/ 這裡介紹各種在 Linux 中以手動來調 ...

  7. Linux 时间设置和同步服务

    修改日期时间的工具 date hwclock timedatectl date工具的使用 作用:显示和设置系统时间 选项: -d <字符串> 显示字符串所指的日期与时间,比如:" ...

  8. centos7 时间自动同步

    设置开机自动同步Internet时间,并作定时同步任务1.修改时区 rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc ...

  9. CentOS7日期时间设置方法以及时间基本概念介绍

    在CentOS 6版本,时间设置有date.hwclock命令,从CentOS 7开始,使用了一个新的命令timedatectl. 一.基本概念 1.1 GMT.UTC.CST.DST 时间 (1) ...

随机推荐

  1. 加快cin读取速度

    cin在读取大量数据时会比C里的scanf慢很多,但这并不是cin"无能",而是C++为了兼容C,对cin做了scanf的同步,只要关闭这个同步,cin就会有不弱于scanf的速度 ...

  2. windows批处理定时关机

    2017-04-11 windows bat文件可以简化很多cmd命令,为我们提供很多方便.今天介绍定时关机的批处理代码实现: 我们知道windows下的定时关机可以通过shutdown命令实现,如果 ...

  3. CSS小知识-----前缀-moz-、-ms-、-webkit-,-o-分别代表的意思

    这种方式在业界上统称:识别码.前缀 -ms-代表[ie]内核识别码 -moz-代表火狐[firefox]内核识别码 -webkit-代表谷歌[chrome]/苹果[safari]内核识别码 -o-代表 ...

  4. 【2017-03-23】CSS基础:内联样式

    CSS:层叠式样式表 1.对层标签整体进行操作 <div style="width:200px;height:200px;background-color:blue"> ...

  5. <keep-alvie></keep-alive>

    <keep-alive></keep-alive>的作用是什么? <keep-alive></keep-alive> 包裹动态组件时,会缓存不活动的组件 ...

  6. python pprint

    使用 pprint 模块 pprint 模块( pretty printer ) 用于打印 Python 数据结构. 当你在命令行下打印特定数据结构时你会发现它很有用(输出格式比较整齐, 便于阅读). ...

  7. rabbitMq 教程

    https://github.com/401Studio/WeekLearn/issues/2 目录 RabbitMQ 概念 exchange交换机机制 什么是交换机 binding? Direct ...

  8. java连接oracle数据库使用SERVICE NAME、SID以及TNSName不同写法

    格式一: 使用ServiceName方式: jdbc:oracle:thin:@//<host>:<port>/<service_name> 例 jdbc:orac ...

  9. 阻塞队列---ArrayBlockingQueue,LinkedBlockingQueue,DelayQueue源码分析

    阻塞队列和非阻塞队列阻塞队列和非阻塞队列的区别:阻塞队列可以自己阻塞,非阻塞队列不能自己阻塞,只能使用队列wait(),notify()进行队列消息传送.而阻塞队列当队列里面没有值时,会阻塞直到有值输 ...

  10. HDU 2077 汉诺塔IV (递推)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2077 还记得汉诺塔III吗?他的规则是这样的:不允许直接从最左(右)边移到最右(左)边(每次移动一定是 ...