加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

用bash清理$PATH

发布时间:2020-12-16 01:17:51 所属栏目:安全 来源:网络整理
导读:我的路径有很多很久以前由脚本添加的条目.它们不在我的.bashrc,.bash_profile或.bash_login中. 我担心在.bashrc中重置我的路径会产生不良的长期结果.有没有办法找到添加到我的路径的地方并手动删除它们?事物是总是按文件添加还是路径缓存在某个地方?如果是
我的路径有很多很久以前由脚本添加的条目.它们不在我的.bashrc,.bash_profile或.bash_login中.

我担心在.bashrc中重置我的路径会产生不良的长期结果.有没有办法找到添加到我的路径的地方并手动删除它们?事物是总是按文件添加还是路径缓存在某个地方?如果是后者,是否容易清理?

找到修改PATH的最简单方法是运行:
  $bash --login -i -xv 2>&1 | grep ' . '

比如我得到了:

+ . /etc/profile.d/bash_completion.sh
        . /etc/bash_completion
++ . /etc/bash_completion
+++ . /etc/bash_completion.d/abook
+++ . /etc/bash_completion.d/ant
+ . /etc/profile.d/lapack0.sh
+ . /etc/profile.d/openssl.sh
+ . /etc/profile.d/qt3-devel.sh
+ . /etc/profile.d/tetex-profile.sh
+ . /etc/profile.d/xinit.sh
+ . /etc/bash.bashrc

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读