Mohib Mohib - 1 year ago 106
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

Answer Source

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\] '
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download