timedatectl 是 RHEL7 上的一项新功能。它可用于查询和更改系统时钟及其设置。

按照以下步骤将时区更改为中国。(以root用户身份执行以下命令)。

1.使用以下命令列出所有可用的时区。你将使用此命令获得一长串时区。

# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
....

2.找到中国时区中所需的正确时区并设置特定时区。有一个名为 tzselect 的命令可以帮助您找到所需的时区。例如,要在中国查找时区,请按如下所示使用它:

# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
) Africa
) Americas
) Antarctica
) Arctic Ocean
) Asia
) Atlantic Ocean
) Australia
) Europe
) Indian Ocean
) Pacific Ocean
) none - I want to specify the time zone using the Posix TZ format.
#?
Please select a country.
) Afghanistan ) Israel ) Palestine
) Armenia ) Japan ) Philippines
) Azerbaijan ) Jordan ) Qatar
) Bahrain ) Kazakhstan ) Russia
) Bangladesh ) Korea (North) ) Saudi Arabia
) Bhutan ) Korea (South) ) Singapore
) Brunei ) Kuwait ) Sri Lanka
) Cambodia ) Kyrgyzstan ) Syria
) China ) Laos ) Taiwan
) Cyprus ) Lebanon ) Tajikistan
) East Timor ) Macau ) Thailand
) Georgia ) Malaysia ) Turkmenistan
) Hong Kong ) Mongolia ) United Arab Emirates
) India ) Myanmar (Burma) ) Uzbekistan
) Indonesia ) Nepal ) Vietnam
) Iran ) Oman ) Yemen
) Iraq ) Pakistan
#?

Please select one of the following time zone regions.
  1) Beijing Time
  2) Xinjiang Time
  #? 1


The following information has been given:


China
  Beijing Time


Therefore TZ='Asia/Shanghai' will be used.
  Local time is now: Thu Aug 22 16:57:30 CST 2019.
  Universal Time is now: Thu Aug 22 08:57:30 UTC 2019.
  Is the above information OK?
  1) Yes
  2) No
  #? 1


You can make this change permanent for yourself by appending the line
  TZ='Asia/Shanghai'; export TZ
  to the file '.profile' in your home directory; then log out and log in again.


Here is that TZ value again, this time on standard output so that you
  can use the /usr/bin/tzselect command in shell scripts:
  Asia/Shanghai

 
# timedatectl set-timezone Asia/Kolkata

3. 运行 “date” 命令查看时间是否正确

# date
Thu Aug :: CST

您还可以使用 timedatectl status 命令检查详细状态。

# timedatectl status
Local time: Thu -- :: CST
Universal time: Thu -- :: UTC
RTC time: Thu -- ::
Time zone: Asia/Shanghai (CST, +)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

CentOS / RHEL 7 更改时区的更多相关文章

  1. [转帖]如何重置CentOS/RHEL 7中遗忘的根用户帐户密码

    如何重置CentOS/RHEL 7中遗忘的根用户帐户密码 https://www.cnblogs.com/swordxia/p/4389466.html 作者的blog质量很高呢 没看完 但是感觉 很 ...

  2. Linux 更改时区

    原文:https://www.cnblogs.com/st-jun/p/7737188.html Linux修改时区的正确方法 CentOS和Ubuntu的时区文件是/etc/localtime,但是 ...

  3. 【Linux笔记】CentOS&RHEL YUM基础知识

    以下内容收集自网络,以作参考. 一.YUM是什么 YUM = Yellow dog Updater, Modified. 主要功能是更方便的添加/删除/更新RPM包. 它能自动解决包的倚赖性问题. 它 ...

  4. 【Linux】YUM Repositories for CentOS, RHEL & Fedora Systems

    这里是官方wiki:https://wiki.centos.org/AdditionalResources/Repositories 一.简介 YUM(Yellowdog Updater Modifi ...

  5. 如何在CentOS/RHEL & Fedora上安装MongoDB 3.2

    MongoDB(名称取自"huMONGOus")是一个有着全面灵活的索引支持和丰富的查询的数据库.MongoDB通过GridFS提供强大的媒体存储.点击这里获取MongoDB的更多 ...

  6. PHP 5.4 on CentOS/RHEL 6.4 and 5.9 via Yum

    PHP 5.4 on CentOS/RHEL 6.4 and 5.9 via Yum PHP 5.4.16 has been released on PHP.net on 6th June 2013, ...

  7. [转载]PHP 5.6 on CentOS/RHEL 7.0 and 6.6 via Yum

    https://webtatic.com/packages/php56/ PHP 5.6.5 has been released on PHP.net on 22nd January 2014, an ...

  8. 通过yum升级CentOS/RHEL最小化安装

    1.如果你有安装CentOS / RHEL最小服务器安装,您可能有很多麻烦没有安装包 2.有一种方法来安装所有的包,需要一个基本的服务器,使用yum groupinstall命令 3.从最小的安装基本 ...

  9. 在CentOS/RHEL 6.5上安装Chromium 谷歌浏览器

    之前Google就说了,由于CentOS/RHEL 6已经是过期的系统,所以不再会有Chrome了. 虽然后来由于引起了社区的抗议,从而改口,不再提CentOS/RHEL 6是过期系统了:但是,目前在 ...

随机推荐

  1. C实现除法

    C实现除法 来源 Leetcode上的一个题,做完后感觉很有意义,因而记录. 实际上自己也查阅了不少的实现除法的方式,最后还是感觉这个方法是最好的,没有别的原因,就是快. 需要注意的一些点 正整数之间 ...

  2. LeetCode - 82、删除排序链表中的重复元素 II

    给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字. 示例 1: 输入: 1->2->3->3->4->4->5    输出: 1 ...

  3. Alpha冲刺随笔六:第六天

    课程名称:软件工程1916|W(福州大学) 作业要求:项目Alpha冲刺(十天冲刺) 团队名称:葫芦娃队 作业目标:在十天冲刺里对每天的任务进行总结. 随笔汇总:https://www.cnblogs ...

  4. Idea导入maven项目

    1.idea中有项目的关闭项目  File>>close project  回到截图 下一步>下一步

  5. tensorflow API _ 2 (tf.app.flags.FLAGS)

    tf.app.flags.FLAGS 的使用,主要是在用命令行执行程序时,需要传些参数,代码如下:新建一个名为:app_flags.py 的文件. #coding:utf-8  import tens ...

  6. win10 安装python模块objgraph+PyCharm环境配置

    1. 打开win10的命令行窗口 2.在命令行中输入python -m pip install objgraph,系统会自动帮忙安装 3.安装完成后,可以用命令python -m pip list查看 ...

  7. LightOJ - 1095 - Arrange the Numbers(错排)

    链接: https://vjudge.net/problem/LightOJ-1095 题意: Consider this sequence {1, 2, 3 ... N}, as an initia ...

  8. MongoDB collection Index DB 大小查询

    1.collection中的数据大小 db.collection.dataSize() 2.为collection分配的空间大小,包括未使用的空间db.collection.storageSize() ...

  9. 本地存储API

    一.定义 随着互联网的快速发展,基于网页的应用越来越普遍,同时也变得越来越复杂,为了满足各种各样的需求,会经常在本地存储大量的数据,HTML5规范提出了相关解决方案 本地存储设置读取方便,容量较大,s ...

  10. 【dp】P1541 乌龟棋

    链接: https://www.luogu.org/problemnew/show/P1541 [思路]: 用f[a][b][c][d]表示,第一张卡用a张,第二张卡用b张..........然后就盘 ...