I recently updated my Ubuntu 14.04 using the software update.

This caused some problems. Initially I couldn't open up a new terminal window due to unknown errors with my .bashrc I had to use another shell to remove my .bashrc file to fix it. While slowly adding back the .bashrc file I now have a problem with my PS1 prompt settings.

For a while I've used

git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
HOST='\033[02;36m\]\h'; HOST=' '$HOST
TIME='\033[01;31m\]\t \033[01;32m\]'
LOCATION=' \033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
BRANCH=' \033[00;33m\]$(git_branch)\[\033[00m\]\n\$ '

in my .bashrc to show time, user, host, pwd and git branch (in various colors) within my prompt.

After the upgrade I have a strange character at the start of each of those that didn't used to be there. Some sort of small outlined box with 4 tiny numbers in it !

enter image description here

What is causing this & how to fix it?

  • With that "tiny box with 4 numbers", the terminal is showing you some character it cannot print in the current locale/characterset. – Ariel Feb 28 '15 at 13:22

The answer seems to be that I needed to add a \[ before the \033[ constructs, e.g.


HOST='\033[02;36m\]\h'; HOST=' '$HOST


HOST='\[\033[02;36m\]\h'; HOST=' '$HOST

enter image description here

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.