当前位置:   article > 正文

【Ubuntu日常技巧】Ubuntu命令行设置系统时区、时间

比利时对应ubuntu 时区英文

最近折腾手机上安装Ubuntu,发现显示的时间不对,可惜当前的 Date and Time菜单中没法进行时间设置,而且其显示的为London地区的时间,故通过命令行修改之;

1、确定所在时区的编号

可以通过tzselect命令实现:

  1. phablet@localhost:~$ tzselect
  2. Please identify a location so that time zone rules can be set correctly.
  3. Please select a continent or ocean.
  4. 1) Africa
  5. 2) Americas
  6. 3) Antarctica
  7. 4) Arctic Ocean
  8. 5) Asia
  9. 6) Atlantic Ocean
  10. 7) Australia
  11. 8) Europe
  12. 9) Indian Ocean
  13. 10) Pacific Ocean
  14. 11) none - I want to specify the time zone using the Posix TZ format.
  15. #? 5
  16. Please select a country.
  17. 1) Afghanistan 18) Israel 35) Palestine
  18. 2) Armenia 19) Japan 36) Philippines
  19. 3) Azerbaijan 20) Jordan 37) Qatar
  20. 4) Bahrain 21) Kazakhstan 38) Russia
  21. 5) Bangladesh 22) Korea (North) 39) Saudi Arabia
  22. 6) Bhutan 23) Korea (South) 40) Singapore
  23. 7) Brunei 24) Kuwait 41) Sri Lanka
  24. 8) Cambodia 25) Kyrgyzstan 42) Syria
  25. 9) China 26) Laos 43) Taiwan
  26. 10) Cyprus 27) Lebanon 44) Tajikistan
  27. 11) East Timor 28) Macau 45) Thailand
  28. 12) Georgia 29) Malaysia 46) Turkmenistan
  29. 13) Hong Kong 30) Mongolia 47) United Arab Emirates
  30. 14) India 31) Myanmar (Burma) 48) Uzbekistan
  31. 15) Indonesia 32) Nepal 49) Vietnam
  32. 16) Iran 33) Oman 50) Yemen
  33. 17) Iraq 34) Pakistan
  34. #? 9
  35. Please select one of the following time zone regions.
  36. 1) east China - Beijing, Guangdong, Shanghai, etc.
  37. 2) Heilongjiang (except Mohe), Jilin
  38. 3) central China - Sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.
  39. 4) most of Tibet & Xinjiang
  40. 5) west Tibet & Xinjiang
  41. #? 1
  42. The following information has been given:
  43. China
  44. east China - Beijing, Guangdong, Shanghai, etc.
  45. Therefore TZ='Asia/Shanghai' will be used.
  46. Local time is now: Sun Mar 24 11:54:21 CST 2013.
  47. Universal Time is now: Sun Mar 24 03:54:21 UTC 2013.
  48. Is the above information OK?
  49. 1) Yes
  50. 2) No
  51. #? 1
  52. You can make this change permanent for yourself by appending the line
  53. TZ='Asia/Shanghai'; export TZ
  54. to the file '.profile' in your home directory; then log out and log in again.
  55. Here is that TZ value again, this time on standard output so that you
  56. can use the /usr/bin/tzselect command in shell scripts:
  57. Asia/Shanghai

注意每次显示对于菜单后,在出现的 #?  后面 输入对于编号就可以了;最后一行为找到的时区信息;为: 

Asia/Shanghai

2、设置localtime

sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

马上就可以发现时间已经改过来了;

更多时区信息可以在以下目录中去选取:

/usr/share/zoneinfo/
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/144308
推荐阅读
相关标签
  

闽ICP备14008679号