Linux 修改本地时间 (centos为例)

1.  tzselect

[root@xxxx etc]# 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 ) *
) Cyprus ) Lebanon ) Tajikistan
) East Timor ) Macau ) Thailand
) Georgia ) Malaysia ) Turkmenistan
) * ) * ) United Arab Emirates
) India ) Myanmar (Burma) ) Uzbekistan
) Indonesia ) Nepal ) Vietnam
) Iran ) Oman ) Yemen
) Iraq ) Pakistan
#?
Please select one of the following time zone regions.
) Beijing Time
) * Time
Please enter a number in range.
#? The following information has been given: China
Beijing Time Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Thu May :: CST .
Universal Time is now: Thu May :: UTC .
Is the above information OK?
) Yes
) No

    即可重新加载 本地时间

  date  查看本地时间

  

2.    修改本地 localtime 文件

  Linux 修改本地时间 (centos为例)

查看/usr/share/zoneinfo 文件夹, 发现全部为地区时间文件

Linux 修改本地时间 (centos为例)

故:  

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/lcoaltime

date 查看时间, 变为上海  东八区时间

3. ntpdate & ntpd

  yum -y install ntpdate ntp

同步在线网络s

  ntpdate  xxxx

  

crontab: 没十分钟调整一次时间;

*/ * * * * ntpdate time.nist.gov   #域名或IP

  一级时间服务器列表:http://support.ntp.org/bin/view/Servers/StratumOneTimeServers

  二级时间服务器列表:http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers

上一篇:HUST 1027 Enemy Target!


下一篇:删除链表倒数第n个节点