Linux 7 修改时区不生效怎么办

发布时间:2021-11-04 17:49:27 作者:柒染
来源:亿速云 阅读:363

这期内容当中小编将会给大家带来有关Linux 7 修改时区不生效怎么办,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

查看当前时区

[root@tidb01 ~]# date
Sat Jun 27 13:58:27 EDT 2020
[root@tidb01 ~]# date -R
Sat, 27 Jun 2020 13:58:36 -0400

修改时区

方法一:

[root@tidb01 ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@tidb01 ~]# ls -l /etc/localtime
lrwxrwxrwx 1 root root 35 Jun 28 02:08 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai

方法二:

[root@tidb01 ~]# timedatectl set-timezone Asia/Shanghai

方法三:

[root@tidb01 ~]# cat /etc/profile
[root@tidb01 ~]# cat .bash_profile 
[root@tidb01 ~]# cat .bash_profile 
TZ='Asia/Shanghai'; export TZ

方法四:

[root@tidb01 ~]# tzselect 
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
 1) Africa
 2) Americas
 3) Antarctica
 4) Arctic Ocean
 5) Asia
 6) Atlantic Ocean
 7) Australia
 8) Europe
 9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
......

查询时区并没有修改成功

[root@tidb01 ~]# date
Sat Jun 27 13:58:50 EDT 2020

尝试将其他东8区时区操作系统上的Shanghai文件拷贝过来

[root@tidb02 ~]# cp /usr/share/zoneinfo/Asia/Shanghai .
[root@tidb02 ~]# scp Shanghai 192.168.30.101:/root

时区修改成功

[root@tidb01 ~]# date
Sat Jun 27 14:23:04 CST 2020
[root@tidb01 ~]# date -R
Sat, 27 Jun 2020 14:23:13 +0800

上述就是小编为大家分享的Linux 7 修改时区不生效怎么办了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. Linux及Unix调整系统时间和时区的方法
  2. 运维作战之安装linux系统

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux

上一篇:如何理解LVM基本特性及日常管理

下一篇:怎么查看oralce隐含参数并在SQLPLUS窗口格式化输出

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》