设置时区
1. 使用 tzselect 选择时区。
tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
…
5) Asia
…
#? 5
Please select a country.
…
9) China 26) Laos 43) Taiwan
…
#? 9
Please select one of the following time zone regions.
…
- east China - Beijing, Guangdong, Shanghai, etc.
…
#? 1
The following information has been given:
China east China - Beijing, Guangdong, Shanghai, etc.Therefore TZ=‘Asia/Shanghai’ will be used.
Local time is now: Wed Jun 5 15:17:02 CST 2019.
Universal Time is now: Wed Jun 5 07:17:02 UTC 2019.
Is the above information OK?
- Yes
- No
#? 1
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
2. 将时区写入到 rc.local
文件路径:
/etc/rc.d/rc.local
文件内容:
TZ='Asia/Shanghai'; export TZ
本文详细介绍了如何在Linux系统中设置正确的时区。通过使用tzselect工具,用户可以选择所在地理位置,进而确定具体的时区,例如亚洲上海。此外,还介绍了如何将时区设置永久保存在个人配置文件中,以及如何在rc.local文件中写入时区信息。

2899

被折叠的 条评论
为什么被折叠?



