在 Ubuntu(以及一般的 Linux shell)里,aliases 冲突通常指以下几种情况之一:
.bashrc、.bash_aliases、.zshrc)下面按场景给你解决办法。
alias
或只看某个:
alias ll
grep -R "alias ll" ~/
常见位置:
~/.bashrc~/.bash_aliases~/.profile~/.zshrc例如:
alias ls='ls --color=auto'
你又写了:
alias ls='ls -F'
解决方式:
alias ls='ls --color=auto -F'
alias l='ls -F'
例如 .bashrc 和 .bash_aliases 都有:
alias grep='grep --color=auto'
解决方式:
.bash_aliases).bashrc 中只写:if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
例如:
alias git='git status'
但你想用真正的 git
解决:
\git
command git
unalias git
你在 .bashrc 写的东西,在 zsh 不生效或冲突
解决:
.bashrc.zshrc✅ 集中管理 alias
~/.bash_aliases
✅ 命名规范
gst(git status)ls、cd、rm✅ 生效前检查
type ll
如果是 alias,会显示:
ll is aliased to `ls -l'
unalias -a
⚠️ 会清空当前 shell 所有 alias
如果你愿意,可以把具体冲突的 alias 名 + 报错或现象发出来,我可以直接帮你改配置。