Insert \[ and \] around the ANSI escape sequences: Original: PS1="\n\e[0;34m\][\u@\h]\e[0;36m\][\W]\e[0;m\] ⌘ " Modified: PS1="\n\[\e[0;34m\][\u@\h]\e[0;36m\][\W]\e[0;m\]\] ⌘ "