Linux 设置时区

设置时区

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.

  1. 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?

  1. Yes
  2. 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值