Ubuntu20 修改系统时区为 国内时间

问题:

一般情况下,Ubuntu时间与实际时间相差8小时,因为他的时区设置为0时区,而我们想让他为北京时间。

校正方法如下:

  1. 运行tzselect,选择Asia(亚洲)
root@computer:~# tzselect 
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
 1) Africa
 2) Americas
 3) Antarctica
 4) Asia
 5) Atlantic Ocean
 6) Australia
 7) Europe
 8) Indian Ocean
 9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the timezone using the Posix TZ format.
#? 4
  1. 选择China,然后选定北京时间
Please select a country whose clocks agree with yours.
 1) Afghanistan			       29) Kyrgyzstan
 2) Antarctica			       30) Laos
 3) Armenia			       31) Lebanon
 4) Azerbaijan			       32) Macau
 5) Bahrain			       33) Malaysia
 6) Bangladesh			       34) Mongolia
 7) Bhutan			       35) Myanmar (Burma)
 8) Brunei			       36) Nepal
 9) Cambodia			       37) Oman
10) China			       38) Pakistan
11) Christmas Island		       39) Palestine
12) Cocos (Keeling) Islands	       40) Philippines
13) Cyprus			       41) Qatar
14) East Timor			       42) Réunion
15) French Southern & Antarctic Lands  43) Russia
16) Georgia			       44) Saudi Arabia
17) Hong Kong			       45) Seychelles
18) India			       46) Singapore
19) Indonesia			       47) Sri Lanka
20) Iran			       48) Syria
21) Iraq			       49) Taiwan
22) Israel			       50) Tajikistan
23) Japan			       51) Thailand
24) Jordan			       52) Turkmenistan
25) Kazakhstan			       53) United Arab Emirates
26) Korea (North)		       54) Uzbekistan
27) Korea (South)		       55) Vietnam
28) Kuwait			       56) Yemen
#? 10
Please select one of the following timezones.
1) Beijing Time
2) Xinjiang Time, Vostok
#? 1

The following information has been given:

	China
	Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Selected time is now:	Tue Oct 25 15:23:34 CST 2022.
Universal Time is now:	Tue Oct 25 07:23:34 UTC 2022.
Is the above information OK?
1) Yes
2) No
#? 1

  1. 复制文件到本地时间内
sudo cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

现在再用date命令时,就能发现已经是东八区标准时间了

root@computer:~# date
Tue 25 Oct 2022 07:25:05 AM UTC
  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值