characters stick at the beginning of CLI

Solution 1:

Your Bash prompt is not properly escaped for non-printing characters, so it thinks the prompt is longer than it truly is (and doesn't delete some of the characters). To fix it, add \[ and \] around the invisible parts.

You need to change it to:

export PS1='\[\e[31m\]\W\[\e[0m\] '