I am under Ubuntu 12.04 LTS.
I have added such line to ~/.bashrc

alias myconf="sudo nano /opt/nginx/conf/sites-available/efiling"

I tried with single quotes too:

alias myconf='sudo nano /opt/nginx/conf/sites-available/efiling'

Then I logged out and logged in again.

test@STORK:~$ myconf
myconf: command not found

But after test@STORK:~$ source ~/.bashrc it works.

Can Anyone help me?

  • Logout and login and then check the command alias.... it works for me
    – user285686
    May 27 '14 at 6:25
  • It is better to put all your aliases in ~/.bash_aliases than in ~/.bashrc. Though technically it won't make a difference, but for administrative purpose.
    – jobin
    May 27 '14 at 6:57

I think it should be

alias myconf='sudo nano /opt/nginx/conf/sites-available/efiling'

with single-quotes instead of double-quotes.

You can also use

$ source ~/.bashrc

to load bash.rc without closing the terminal/logging out.

  • 1
    Thaks for help. source ~/.bashrc helped me. But why it isn't applied automatically when I am logging in? Aug 15 '12 at 8:00
  • Check the file ~/.profile to see whether bash.rc is loaded on logging in. Aug 15 '12 at 8:06
  • ~/.profile contains if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi Aug 15 '12 at 8:27
  • 1
    That looks okay. What about the two files ~/.bash_profile and ~/.bash_login, do these exist on your system? Because in my default .profile file the comment at the top says that, "This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login exists." Aug 15 '12 at 8:34
  • 1
    Oh, thanks a lot. Iy works. It was a problem that I had bash_login file. Aug 15 '12 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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