Alias and .bashrc


I’m trying to make some alias for some commands/programs and save them to .bashrc so that each time I login I could use those aliases, but for some reason aliases don’t work in .bashrc.

For example if I wanted to assign ‘ls -l --color=auto’ to ‘ll’ I would save this command in my /home/myusername/.bashrc

alias ll=‘ls -l --color=auto’

If I want to run a script or a program without specifying path to them I would put it in any of the echo $PATH directories, but since /home/myusername/bin is not one of them and I don’t have write access to any other bin directories how can I do that? Only choise is using aliases? How do I save aliases then, so that I don’t have to type them each time I login?


Save the commands to the .bash_profile file.



You can modify the PATH to include your own bin directory. Add the following to .bash_profile:

export PATH


Thank you both for your fast reply :slight_smile: Everything works now just as it should :smiley:

I saw this in ~/.bashrc before but didn’t give it much attention:

~/.bashrc: executed by bash(1) for non-login shells.

What exactly does that mean? ~/.bashrc executes when logging in with ftp? or doesn’t mean anything? or something else?


You get a login shell if you connect with ssh, telnet, etc. You get a non-login shell if you just run bash from the command line or use su (without the - option).