zoukankan      html  css  js  c++  java
  • Linux 查看系统时间

    =============================== CentOS 7.6 ===============================

    一、一般在做定时任务或其他工作时,系统的时间都会影响其功能的运行。

    1、查看系统时间:

    [root@csxt ~]# date
    Thu Mar 26 13:55:46 CST 2020
    [root@csxt ~]# 

    2、如果要更换到其他时区的系统时间。

    [root@csxt ~]# tzselect    -- 这个是选择具体时区的命令,一般先选择州。
    Please identify a location so that time zone rules can be set correctly.
    Please select a continent or ocean.
    1) Africa
    2) Americas
    3) Antarctica
    4) Arctic Ocean
    5) Asia
    6) Atlantic Ocean
    7) Australia
    8) Europe
    9) Indian Ocean
    10) Pacific Ocean
    11) none - I want to specify the time zone using the Posix TZ format.
    #? 5

    3、然后选择国家/城市,即可

    #? 5
    Please select a country.
     1) Afghanistan          18) Israel            35) Palestine
     2) Armenia          19) Japan            36) Philippines
     3) Azerbaijan          20) Jordan            37) Qatar
     4) Bahrain          21) Kazakhstan        38) Russia
     5) Bangladesh          22) Korea (North)        39) Saudi Arabia
     6) Bhutan          23) Korea (South)        40) Singapore
     7) Brunei          24) Kuwait            41) Sri Lanka
     8) Cambodia          25) Kyrgyzstan        42) Syria
     9) China          26) Laos            43) Taiwan
    10) Cyprus          27) Lebanon            44) Tajikistan
    11) East Timor          28) Macau            45) Thailand
    12) Georgia          29) Malaysia            46) Turkmenistan
    13) Hong Kong          30) Mongolia            47) United Arab Emirates
    14) India          31) Myanmar (Burma)        48) Uzbekistan
    15) Indonesia          32) Nepal            49) Vietnam
    16) Iran          33) Oman            50) Yemen
    17) Iraq          34) Pakistan
    #? 9
    Please select one of the following time zone regions.
    1) Beijing Time
    2) Xinjiang Time
    #? 1

    4、执行完tzselect命令选择时区后,时区并没有更改,只是在命令最后提示你可以执行TZ=‘Asia/Shanghai’; export TZ 并将这行命令添加到.profile中,然后退出并重新登录。参考下图中date命令看到的结果,最终时区显示为CST,即中国标准时间

    5. 修改/etc/sysconfig/clock ZONE=Asia/Shanghai
    6. mv /etc/localtime /etc/localtime_back && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    7. rdate -t 60 -s stdtime.gov.hk && hwclock -w (同步时间,安装rdate:yum -y install rdate)
    ———————————————————————————————————————————————
    (4、5、6、7) 来自 【原文链接:https://blog.csdn.net/qq_35012243/article/details/82746519】

  • 相关阅读:
    【Spring】 AOP Base
    【Offer】[20] 【表示数值的字符串】
    【Offer】[19] 【字符串匹配】
    【设计模式】代理模式
    【LeetCode】[0002] 【两数之和】
    【Offer】[18-1] 【在O(1)时间内删除链表节点】
    【Offer】[18-2] 【删除链表中重复的节点】
    【Offer】[17] 【打印1到最大的n位数】
    【Offer】[16] 【数值的整数次方】
    python_内置函数
  • 原文地址:https://www.cnblogs.com/yuezc/p/12574158.html
Copyright © 2011-2022 走看看