linux - .bashrc 和 .bash_profile 丢失
问题描述
我在 .bash_profile 中添加了一些内容。我通过向 $PATH 添加一些路径搞砸了。注销并重新登录后,我找不到 .bashrc 或 .bash_profile。但是当我回显 $PATH 或在 bashrc 中设置的东西时,它会出现。所以,我尝试从 /etc/skel/ 复制 .bashrc 和 .bash_profile。即使在复制和重新启动之后,出于某种原因,我的旧别名和所有内容都是从旧的 .bashrc 中挑选出来的。我完全想删除之前设置的所有内容并创建一个新的 .bashrc 和 .bash_profile。
即使在复制新的 .bashrc 和 .bash_profile 并对它们进行源 ~/.bashrc 并重新启动后,我仍然看到这个来自旧的 .bashrc:
[user@user.x main]$ git branch
/opt/cross/rh-git29/root/usr/bin/git: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
[user@user.x main]$which git
alias git='/opt/cross/rh-git29/root/usr/bin/git'
/opt/cross/rh-git29/root/usr/bin/git
此外,现在当我打开 .bashrc 和 .bash_profile 时,它会从 /etc/skel 打开复制的文件,但它会在 vim 中附加 //。如果我执行“vim ~/.bashrc”,打开后我会在 vim 窗口中看到 ~//.bashrc。
此外,当我执行“alias -p”时,该 .bashrc 配置文件中的旧别名仍然出现。我使用 unalias 删除了别名,但它仍然会出现。即使我在当前的 .bashrc 中设置了新的 $HOME,我的旧 $HOME 仍然会显示。
如何检查旧 .bashrc 和 .bash_profile 的路径以及为什么会被拾取?我如何完全重置这些配置文件?如何永久删除这些别名 - 尝试在当前 .bashrc 中同时使用 unalias 和设置别名 git="git" 以覆盖,但它在注销后仍会选择旧别名。
解决方案
推荐阅读
- python - 量化不同属性的 3D 点集群
- python - tkinter:获取标签小部件以显示输出
- flutter - Flutter TextField 不读取字母 č
- c# - WPF ListBox - 为一个列表组合 2 个表
- wordpress - 如何在woocommerce中限制每个产品的一次评论
- ios - iOS Swift:Mapbox 路由计算不起作用,“类型值‘结果’
' 没有成员 'first'" - pine-script - 如何用整数覆盖输入整数
- javascript - 尝试更新待办事项应用程序中的列表时无法调用 setState()
- google-play-console - Google Play 发布前报告不再包含设备日志
- azure-devops - 如何将 Appium 测试的 Allure 报告器与 Azure DevOps 集成?