This is embarrassing, but I don't seem to be able to set the command-prompt or the shell title. I'm using Gnome3 on centos 7.


I've added the following to ~/.bashrc:

export PS1="\w \$ "

The prompt stays the same:

echo $PS1
[\u@\h \W]\$

I've also tried updating the ~/.bashrc without the export:

PS1="\w \$ "

Same result.

It is almost like something is overriding it.


As for the title I've tried the following:

echo -ne "\033]0;hi\007"

It doesn't take effect.

  • is there a .env file in your home folder that has PS1 in it? – Max Vernon Aug 8 '14 at 18:37
  • @MaxVernon no .env. I rebooted the machine and now my terminal prompt shows what i expect "\w \$" However I still cannot set my title. Although there are no .env file there is a .config folder. – hba Aug 8 '14 at 19:04
  • I use printf "\033]0;hi\007" embedded in a little function: title () { printf "\033]0;${1}\007" } – ericx Aug 8 '14 at 22:01
  • @ericx Thanks but that doesn't work either. It is really frustrating...i use it on osx and ubuntu not sure why it is so stubborn on gnome 3 - clearly the fault lies with the user :D – hba Aug 8 '14 at 22:21

Here is what I had to do in my .bashrc

export PS1="\\n[\\!. \\t - \\w]\\n>"

set_title() {
        PROMPT_COMMAND='echo -ne "\033]0;'$1'\007"'

I found this answer useful.

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.