On RedHat, screen resets my bash prompt. I set PS1=\u@\h:\w in ~/.bashrc and ~/.bash_profile.

I added shell -$SHELL as well to ~/.screenrc.

But, when I open a brand new terminal window, the prompt is correct, except in screen.

In screen I always get this prompt format: \u@\h>

How can I set the same prompt in screen?


I became so tired of the different startup files for shells that I do this:

  • Create a file ~/.shrc and put all my config in it (including the prompt setting)
  • In ~/.profile, ~/.bashrc, ~/.bash_profile and whatever file the shell might read, add this line . ~/.shrc (note the dot)
  • And finally, forget all about the little details that I never quite grasp

In your case, I suspect that Bash wants ~/.profile (a wild guess, because as stated above I never got to fully understand those startup files), so adding that might make it work.

  • Hello, I put "PS1=\u@\h:\w" into: ~/.shrc, ~/.profile, but the screen still reset my prompt. – user2013619 Sep 12 '13 at 14:13
  • @user2013619 try removing the PS1 settings from the other file if you're doing this. – terdon Sep 12 '13 at 14:36

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.