Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am facing a problem with Ubuntu. Bash aliases like ll are not working if I am logging to my system from SSH. It works fine after writing bash as a command in the shell.

It used to work. What could be the problem?

 echo $SHELL
/bin/bash
share|improve this question
up vote 5 down vote accepted

There are different sets of files where you can set those aliases depending on whether Bash was started as a login shell or not.

If you log into your machine (i.e. supply username and password), then Bash will always load /etc/profile, and load the first of ~/.bash_profile, ~/.bash_login and ~/.profile if it finds one of them.

If you start a new terminal from your machine, you will not start a login shell but a so-called interactive shell. This loads ~/.bashrc, but none of the others above, and this is also where your alias will probably be stored.*

To load the contents of .bashrc when you run a login shell, you should add the following to your ~/.bash_profile:

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

Reconnect via SSH, and the alias from ~/.bashrc will be available.

* If it's not in this file, there might be other system-wide bashrc files such as /etc/bash.bashrc on Ubuntu. See: Environment Variables – Community Ubuntu Documentation

share|improve this answer
    
@slhhck Thanks some script have over written ~/.bash_profile. NOw I have fixed that. – Vivek Goel Jun 2 '13 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .