This question already has an answer here:
- Terminal prompt not wrapping correctly 7 answers
I've tried to change my prompt by editing .bashrc:
export PS1="\e[0;32m[\u@\h \W]\$ \e[m"
This seems to work, but ctrl-r to access reverse history ends up with my typing not appearing in the same place as it will be interpreted (like this question). It is fine when using the up or down arrows to select previous commands though.
I've had a look at that question, but can't seem to work out where to apply the escape characters in my prompt. I've tried a few combinations but then I break normal text typing functionality or simple back/forwards through history.
If you could include an explanation of which instances of characters need escaping and why, that would help me (and hopefully others) learn.