在 CentOS 里“查看 aliases(别名)”通常指 查看当前 shell 中已定义的 alias。下面按常见场景给你说明。
alias
输出示例:
alias cp='cp -i'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias ll
输出:
alias ll='ls -l --color=auto'
别名一般定义在以下文件中(按顺序加载):
~/.bashrc
~/.bash_profile
~/.bash_aliases
/etc/bashrc
/etc/profile
/etc/profile.d/*.sh
查看某个文件中定义的别名:
grep -R "alias" ~/.bashrc
grep -R "alias" /etc/bashrc
echo $SHELL
CentOS 默认一般是:
/bin/bash
⚠️ 注意:alias 只在交互式 shell 中生效,脚本中默认不生效。
source ~/.bashrc
或:
. ~/.bashrc
type ll
输出示例:
ll is aliased to `ls -l --color=auto'
\ll
command ll
如果你是想:
可以告诉我具体场景,我可以一步步帮你查。