You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
查看时区
date -R # Thu, 20 Jan 2022 10:20:28 +0800
末尾的
+0800
表示时区查看
date
命令手册:date
格式化输出:%Z
表示字符形式的时区缩写,%z
表示数字形式的时区设置时区
使用
tzselect
命令选择时区。输入命令后根据提示选择地理区域
选择结束确认后出现如下提示:
注意: 根据提示得知,
tzselect
并不会永久性修改时区。如果想要永久性修改时区可以按照提示修改环境变量TZ
。/etc/localtime
环境变量
TZ
默认为空,此时系统默认使用/etc/localtime
文件来确认时区。而/etc/localtime
是指向/usr/share/zoneinfo/
文件夹下时区文件的软链接可通过修改
/etc/localtime
的软链地址来设置时区The text was updated successfully, but these errors were encountered: