Mohib Mohib - 5 months ago 47
Linux Question

Linux Terminal Color Design overlapping

I've shorten and add background and foreground color with this code:

PS1='\e[42;1m\u:\e[44m\W\$ \e[0m '

But it overlapping instead of go to next line like this:

enter image description here

Before overlapping:
enter image description here


You are missing the \[ and \] bits which mark the beginning and the end of not-displayable characters. Use this:

export PS1='\[\e[01;42m\]\u:\[\e[01;44m\]\W\$ \[\e[00m\] '