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'd like to change my bash prompt when I login. But even after I change .bashrc and re-login, it still prompts the old one. What goes wrong please?

I want to get [\u@\h \W]\$ but I get \s-\v\$ for some reasons, and I don't know where it was configured.

This account is not the root, however I have root permissions if necessary

This is what I get:

-bash-3.2$ cat .bashrc
PS1='[\u@\h \W]\$'
-bash-3.2$ echo $PS1
\s-\v\$
-bash-3.2$
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Most likely your shell is an interactive login shell, thus it does not read ~/.bashrc but ~/.bash_profile instead:

   When  bash is invoked as an interactive login shell, or as a non-inter‐
   active shell with the --login option, it first reads and executes  com‐
   mands  from  the file /etc/profile, if that file exists.  After reading
   that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
   in  that order, and reads and executes commands from the first one that
   exists and is readable.  The --noprofile option may be  used  when  the
   shell is started to inhibit this behavior.

The quick and dirty fix might be just to symlink ~/.bashrc to ~/.bash_profile or vice versa. This possible breaks something with non-interactive shells, e.g. commands run remotely through SSH, so think twice.

See section "INVOCATION" in man bash for more details.

share|improve this answer
    
I would rather source .bashrc from the profile. –  slhck Feb 26 '14 at 6:59

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.