This question already has an answer here:

Here is my .bashrc config for ps1 i believe ive done it correctly but any time i press up for a previous command it gets all jumbled up. I can write long lines of commands without it wrapping only the "previous history" is giving me trouble.

PS1='\[\e[38;5;9m[\]\[\e[38;5;214m\u\]\[\e[38;5;41m@\]\[\e[38;5;4m\h\] \[\e[38;5;9m\W]\]\[\e[38;5;254m\$ \]'

marked as duplicate by αғsнιη, JdeBP, ilkkachu, Thomas Dickey, Jesse_b May 26 at 13:13

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.

solved moved the actual text I wanted to the outside of the open and closed brackets like so:

PS1='\[\e[38;5;9m\][\[\e[38;5;214m\]\u\[\e[38;5;41m\]@\[\e[38;5;4m\]\h \[\e[38;5;9m\]\W]\[\e[38;5;254m\]\$ '

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