17

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.

Strawberry
  • 66,024
  • 56
  • 149
  • 197

3 Answers3

21

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

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

Community
  • 1
  • 1
cschol
  • 12,799
  • 11
  • 66
  • 80
  • This gave me the answeR: http://stackoverflow.com/questions/415403/whats-the-difference-between-bashrc-bash-profile-and-environment/415444#415444 – Strawberry Oct 17 '10 at 05:05
11

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

Francesco Casula
  • 26,184
  • 15
  • 132
  • 131
6

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.

Purge
  • 647
  • 4
  • 12