This question already has an answer here:

When I scroll through the bash history with the arrow keys and hit (for example) the following string:

git clone hgit clone https://github.com/electron/electron-quick-start

In the next line of history I get something like this:

git clone hls

Where ls is the command from history and git clone h is my unwanted artifact.

The following lines from .bashrc are suspect:

PROMPT_DIRTRIM=2
YELLOW="\[\033[0;33m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
ORANGE="\033[38;5;208m"
PROMPT_COMMAND='echo -ne "\033]0; ${USER}@${HOST}\007"'
PS1="${YELLOW}\u@\h:${ORANGE}\w ${GREEN}\$ "

marked as duplicate by Timothy Martin, Stephen Kitt, terdon bash Mar 8 '17 at 9:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 5 down vote accepted

Your ORANGE is misformed. Instead of this:

ORANGE="\033[38;5;208m"

It should be, as shown below, just like the others:

ORANGE="\[\033[38;5;208m\]"

Not the answer you're looking for? Browse other questions tagged or ask your own question.