Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.