Ubuntu使用tzselect修改时区
2024-08-27 07:14:10
1、命令行运行
sudo tzselect
2、选择洲区(这里选择亚洲Asia)
waichung@desktop:~$ sudo tzselect
[sudo] password for waichung:
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.
#?
3、选择国家(这里选择中国China)
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 ) Taiwan
) Cyprus ) Lebanon ) Tajikistan
) East Timor ) Macau ) Thailand
) Georgia ) Malaysia ) Turkmenistan
) Hong Kong ) Mongolia ) United Arab Emirates
) India ) Myanmar (Burma) ) Uzbekistan
) Indonesia ) Nepal ) Vietnam
) Iran ) Oman ) Yemen
) Iraq ) Pakistan
#?
4、选择北京时间
Please select one of the following time zone regions.
) Beijing Time
) Xinjiang Time
#?
5、选Yes
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
#? You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai
方式1:在用户目录的.profile文件中加入一行下列内容,然后source ~/.profile使其生效
export TZ='Asia/Shanghai'
方式2:复制相应的时区文件到/etc目录下
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
6、同步时间
waichung@desktop:~$ sudo ntpdate pool.ntp.org
May :: ntpdate[]: adjust time server 193.228.143.14 offset -0.154279 sec
最新文章
- 著名的sql注入问题-问题的原因分析及总结
- CLR via C# 3rd - 01 - The CLR's Execution Model
- sublime text3 less2css rem
- 一个解决表单中的文字和文本区域(textarea)上对齐的方法
- PhpStorm下Laravel代码智能提示
- HDOJ/HDU 1200 To and Fro(加密解密字符串)
- 【C++探索之旅】开宗明义+第一部分第一课:什么是C++?
- Vim中设置括号自动补全
- Numpy 学习(一)
- 【软件工程】5.8 黑盒&;白盒测试
- GO调度模型的缺点
- Redis实战 内存淘汰机制
- 全网最详细的Sublime Text 3的设置字体及字体大小(图文详解)
- 二分图最大权匹配模板(pascal)
- spring cloud学习(七)Spring Cloud Config(续)
- .NET 4.5 Task异步编程学习资料
- 读书笔记--C陷阱与缺陷(七)
- java基础---->;java中Properties的使用
- bugku数字验证绕过正则
- ModelForm组件