CentOS 中的别名在哪里设置?

Sho*_*yef 4 unix centos alias bashrc

有一个错字会导致登录时出现错误消息(有人输入lias而不是alias)。我已经检查/etc/bashrc以及~/.bashrc/etc/profile以及~/.bash_profile为个人用户,但这些文件包含了系统的自定义的别名。哪些备用文件可以包含系统范围的别名?

Ric*_*lka 6

很高兴你找到了它,但这里有一种方法可以查看一般意义上的所有登录文件:

# run strace, see every syscall
strace -o /tmp/bash.out bash --login
Run Code Online (Sandbox Code Playgroud)

(从 bash shell 退出)

# filter out opens that returned a descriptor, then use sed to get the file
< /tmp/bash.out grep -o 'open("[^,]*,[^)]*)[ \t]=[ \t][0-9]' | sed -e 's/^[^"]*"//' -e  's/".*$//' | sort -u > /tmp/openedfiles.txt

# grep for the broken alias, or whatever
< /tmp/openedfiles.txt xargs grep '^[ \t]*lias'
Run Code Online (Sandbox Code Playgroud)

如果您知道如何使用它,strace 是那些可以成为魔术的命令之一。