Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a weird issue where my Bash prompt often completely disappears on a backspace. Doesn't make any sense to me, but it happens often:

enter image description here enter image description here

I can't really think of why this is happening. Am I overlooking some configuration file or something?

Here's my PS1 prompt:

PS1='\[\e]2;\u@\h\a\u@\h \W \$ '
share|improve this question
It would help if you posted your $PS1. Otherwise my blind guess is you may not have it wrapped in \[ \]. – jw013 Oct 6 '11 at 21:17
Posted: PS1='\[\e]2;\u@\h\a\u@\h \w \$ ' – Naftuli Tzvi Kay Oct 6 '11 at 23:04
I can reproduce the problem with that PS1. Type a few characters, backspace over them and whoosh, there it goes. – Paul Tomblin Oct 7 '11 at 0:20
What does that PS1 accomplish that PS1='\u@\h \W \$' doesn't? – Paul Tomblin Oct 7 '11 at 0:22
Writing username@host into the actual shell title. – Naftuli Tzvi Kay Oct 7 '11 at 0:33
up vote 9 down vote accepted

As I suspected in my comment, you are missing a \] in your PS1. Try this one:

PS1='\[\e]2;\u@\h\a\]\u@\h \W \$ '

For comparison, the original is

PS1='\[\e]2;\u@\h\a\u@\h \W \$ '
#                  ^ missing \]
share|improve this answer
That fixes it, thanks! – Naftuli Tzvi Kay Oct 7 '11 at 4:04

Check if something running is blanking your PS1 env variable.
As an example on another machine not affected by that problem if you run


in a bash shell you will get the same output of your screen-shots.

share|improve this answer

Your Answer


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.