开发者

How can I automatically load alias on startup?

I am trying to add the alias ll = "ls -l", and I am wondering how can I 开发者_运维知识库load it every time I login to linux.


You can add it to your ~/.bashrc file in your home directory.

For more information on .bashrc and the likes, see this question.


You can add your aliases to ~/.bashrc as explained by cschol but, if you prefer a tidier solution, then you can include all of your additions in one or more files.

Many distributions already do it by default. Just add the following code to your .bashrc file:

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

And then just add your aliases to ~/.bash_aliases


In addition to adding it to ~/.bashrc (which only affects the current user), it can be added to /etc/profile, which will affect all users upon login.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜