2

I'm used to putting my alias in .bashrc, but Ubuntu suggests putting them in .bash_aliases. So that's fine, I put my alias there in the .bash_aliases file. However I want to run my aliases once I log in. In order to do this I need to run bash. Looking around, I've read that I need to put them in .bash_profiles file. If that's the case I believe I need to edit some more files and I'm unclear from that perspective.

What is the simplest way to run aliases on Ubuntu server without running bash each time? I could just run bash and be done with it, but that's one more command.

Any thoughts or ideas would be appreciated.

1 Answer 1

3

After you put your aliases in .bash_aliases, open .bashrc file, find and uncomment or add next lines:

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

Reload your session and check your new aliases.

5
  • It's there already (and yes it's un commented) hence the reason why I thought I wouldn't have to run bash after each reboot.
    – rdcence
    May 29, 2013 at 17:45
  • @rdcence What exactly do you run after each reboot? It can't be bash... Bash is the shell yhat you are using; check with echo $SHELL to understand. May 29, 2013 at 17:59
  • Ah ha! I thought for sure I was running bash, but I'm not (with this particular user)! I'm running /bin/sh so now my question takes on a new form (sorry). When I set up the new user (who needs this alias) I thought it would default to /bin/bash So a) can you point me in the right direction to change the user to bash and b) how would I do this in the first place when I set up a new user?
    – rdcence
    May 29, 2013 at 19:12
  • You are probably right. I should post this "new" question in the right spot. Thanks again for getting me on the right track!
    – rdcence
    May 29, 2013 at 22:26
  • Update: Works perfectly now that the user defaults to bash upon login! Thanks again!!!
    – rdcence
    May 30, 2013 at 13:41

You must log in to answer this question.

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