Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
Logout and login and then check the command alias.... it works for me –  user285686 May 27 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. –  i08in May 27 at 6:57

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Thaks for help. source ~/.bashrc helped me. But why it isn't applied automatically when I am logging in? –  Lesha Pipiev Aug 15 '12 at 8:00
    
Check the file ~/.profile to see whether bash.rc is loaded on logging in. –  Anju Fabulina 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 –  Lesha Pipiev Aug 15 '12 at 8:27
    
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." –  Anju Fabulina Aug 15 '12 at 8:34
    
Oh, thanks a lot. Iy works. It was a problem that I had bash_login file. –  Lesha Pipiev Aug 15 '12 at 8:44

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.