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】

posted @ 2020-03-26 14:13  Yuezc  阅读(1511)  评论(1编辑  收藏  举报