San*_*dra 23 linux ubuntu bash
我想拥有
alias ll="ls -l"
Run Code Online (Sandbox Code Playgroud)
是系统范围的。
这在 Ubuntu 上是如何完成的?
And*_*ith 22
将其添加到/etc/bashrc
. 这将(或应该)在每个使用 bash 的用户登录时调用。
qua*_*nta 20
# echo "alias ll='ls -l'" >> /etc/bash.bashrc
Run Code Online (Sandbox Code Playgroud)
并确保在用户进入 shell 时执行此文件,方法是在 中添加以下内容~/.bashrc
:
# Source global definitions
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
Run Code Online (Sandbox Code Playgroud)
如果您的用户的 $HOME/.bashrc 包含通常的
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
Run Code Online (Sandbox Code Playgroud)
然后把它放在 /etc/bashrc.conf 中。如果没有,那么将它放在 /etc/profile 中,至少可以从那里读取登录 shell。
归档时间: |
|
查看次数: |
50343 次 |
最近记录: |