Linux 设置时区-亲测

tzselect

将 UTC 改成CST

1. # tzselect

依次输入数字  5 9 1 1 设置为 China Standard Timezone

2. 永久化

You can make this change permanent for yourself by appending the line
TZ='Asia/Beijing'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

vi /etc/profile

添加  TZ='Asia/Beijing'; export TZ,之后 souce /etc/profile,使之生效

也可以一句话写完 :

echo "TZ='Asia/Beijing'; export TZ" >> /etc/profile; source /etc/profile

解释下: >> 为 追加,,> 是覆盖,慎用,此处用 >>

3. date 检查时区是否已更改

 

你可能感兴趣的:(操作系统)