易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2617|回复: 0
收起左侧

ubuntu设置时区相关步骤tzselect

[复制链接]
发表于 2021-6-29 10:15:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
root@ubuntu:~# tzselect 2 E, w. `2 Q5 P
Please identify a location so that time zone rules can be set correctly.! m: ~+ Z/ [3 a$ W0 a) P
Please select a continent, ocean, "coord", or "TZ".& H# T* ?- g" T" b( J/ Q: d' v; f
1) Africa
( B2 W0 g0 [! i* G) Y0 w 2) Americas
1 C0 t: c/ J9 }- l/ k. l; h 3) Antarctica
+ ?& Y4 H$ q3 ]) O& Y4 `7 Q1 O 4) Asia1 Y" C$ K7 Q- h. d' G
5) Atlantic Ocean
  V$ D0 b; M( d  _4 U% c 6) Australia
9 I: a/ x1 \8 w# R, `# F 7) Europe
1 r/ k' }3 N1 C 8) Indian Ocean; a1 J6 l- E2 P" ~6 @2 i. U
9) Pacific Ocean5 b6 T& w  @) \* J
10) coord - I want to use geographical coordinates./ S* N& @- `" Q5 e* h' {4 {
11) TZ - I want to specify the timezone using the Posix TZ format.
4 D$ g  |; J+ j8 ^! q0 i+ @0 I$ u#? 4
/ l1 G; o- X% V" APlease select a country whose clocks agree with yours.
8 I+ t2 W# w* ^1 P2 U 1) Afghanistan    18) Israel      35) Palestine
) e% Z6 G9 T: |. ?3 | 2) Armenia    19) Japan      36) Philippines  h0 Q3 ?% }3 P# }7 l3 ]
3) Azerbaijan    20) Jordan      37) Qatar
2 s9 L# u+ L% l; ]: D) D6 U 4) Bahrain    21) Kazakhstan     38) Russia
8 t+ y1 J8 `2 |1 k3 y8 I8 u 5) Bangladesh    22) Korea (North)     39) Saudi Arabia; T3 O2 s( G2 q7 ]
6) Bhutan    23) Korea (South)     40) Singapore9 O* f; P) j* i
7) Brunei    24) Kuwait      41) Sri Lanka6 t* B* [; |6 I, v- A1 y
8) Cambodia    25) Kyrgyzstan     42) Syria% q' M" O% i; ^% }4 s8 q; g; A3 N
9) China    26) Laos      43) Taiwan
  ]0 c% F/ w" `, A0 q; p10) Cyprus    27) Lebanon      44) Tajikistan
, [3 }1 j% @, l# g11) East Timor    28) Macau      45) Thailand
' H% [( m! l5 E' W12) Georgia    29) Malaysia      46) Turkmenistan
" H* w- v! v/ V* z& L7 t, d4 R13) Hong Kong    30) Mongolia      47) United Arab Emirates
' w' ]1 G8 U! y. H  k+ Z5 L4 [- ^14) India    31) Myanmar (Burma)     48) Uzbekistan" X( E2 F/ ^/ f& _, o" Q
15) Indonesia    32) Nepal      49) Vietnam
/ l7 ^5 F9 x* O3 ^! h1 J16) Iran    33) Oman      50) Yemen
' j# c8 ^! z. s  Q1 O17) Iraq    34) Pakistan
2 V( x! H+ ^& K& y; G7 \( `7 ?#? 9
, M" }& m' X/ d6 ~6 CPlease select one of the following timezones.
3 _4 U" z2 z1 i' m3 r; f* i. _* f1) Beijing Time, q5 o; U: ~+ Z! v0 R; o  x
2) Xinjiang Time
! t; k5 T$ Z( ], j$ C#? 1
' H( G5 U( e- |5 ~' g" l/ \The following information has been given:
; o0 Y  {7 `+ B3 o" B: B China
2 J: v2 l2 F1 p( k' w7 P' H1 {+ L4 \ Beijing Time% \, A# ~8 p  D' n3 S! [4 P
Therefore TZ='Asia/Shanghai' will be used." `/ x5 l" P$ ^$ r0 U) b
Selected time is now: Tue Jun 29 10:12:36 CST 2021.
  d* \! `) n; j+ m+ ]# I$ ^Universal Time is now: Tue Jun 29 02:12:36 UTC 2021.
' q$ y/ @- N3 c' a, X& |0 p9 OIs the above information OK?
  u: V" e1 o; {+ ]. t  K1) Yes2 u) d0 A" S( _. Q% V8 I1 {
2) No6 ]  K1 M5 F2 x% {) ?# e
#? 1& q2 Y9 G3 o3 T3 _( B
You can make this change permanent for yourself by appending the line6 I, K) b6 |4 b+ }% N5 H
TZ='Asia/Shanghai'; export TZ4 z6 \- M7 k) Q0 }* m% Q! z
to the file '.profile' in your home directory; then log out and log in again.
3 n4 Z: b, R  w& }Here is that TZ value again, this time on standard output so that you/ }2 T7 M' ]: r" Q% V* t$ i
can use the /usr/bin/tzselect command in shell scripts:
9 D' k) V9 R) V/ ^Asia/Shanghai# R2 m; H+ G4 x3 H0 b: R
root@ubuntu:~# date: z; g; {# D2 @: {; m' x7 k
Tue 29 Jun 2021 10:12:46 AM CST
, A' F- H8 n, A2 u6 Y/ D: Y' w! }& Z& o' h- K: m
& `8 ^  @- z5 @7 r9 w
或者cp timezonf文件:
) ^* D- S0 l5 z5 |" i+ s cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
. D9 C$ g; [2 G) ?ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
0 r4 Q( K; @, N0 ~, d5 d
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:37 , Processed in 0.040283 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表