Note: I am using Putty and my TERM is set to XTERM.

I have added the color to my bash prompt as

PS1="\[\033[0;32m\]\d \t \u\e[1;33m@\H /\W $ \[\033[1;37m\]"

just to simplify PS1 in English -

${GREEN}\d \t \u{YELLOW}@\H \W $ {reset-color}

Now, whenever my command is long and doesn't fit into the line of screen, it should come over to the next line, but it doesn't and the initial character start getting replaced which each character I type. The whole command is present but is not seen completely. It executes normally, so it's just the display that is getting distorted.

The situation worsens when I go back to the first character and try to delete the characters, the whole command line moves up and up erasing the previous data that was on screen.

After some trial and error removing some-part I found that addition a @ leads to the above behavior


I really don't remember why I had put this and I am not able to trace this back.

Can you help me in resolving this issue? The long commands should get on the next line and not on the same line.


1 Answer 1


The ANSI escape sequence right before the “@” sign is not enclosed in \[ and \]. Enclose it and should be fine:

PS1='\[\033[0;32m\]\d \t \u\[\e[1;33m\]@\H /\W $ \[\033[1;37m\]'

By the way, what you call “reset-color” is just setting it to white. To actually reset it use \033[0m.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .