Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use PuTTY to SSH to my linux server. Today I noticed that when I enter a long command that goes beyond the right hand of the screen, instead of wrapping down to the next line, the text starts at the left of the screen on the same line, writing over the top of the characters. I can't figure out what might have changed to cause this. Can anyone give any pointers at what might cause this, and how to resolve? I have Auto wrap mode initially on ticked in PuTTY.

I haven't made any changes to the PuTTY settings for this server, so at a loss why this stopped working correctly.

share|improve this question
up vote 6 down vote accepted

After submitting the question, I had better thought it out, and another search on Google gave me this which pretty much explains it:

My fancy PS1 string was: PS1='\e[0;32m[\u\e[m@\h \W]\$ ' but this included non printing characters (the \e parts which change colour of the username). I needed to escape these non printing characters using \[. The following fixed the issue:

PS1='[\[\e[0;32m\]\u\[\e[m\]@\h \W]\$ '

This results in output like this:

[username@hostname cwd]$

With the username coloured green.

I had edited my PS1 lines so that normal users had their username in red, but if su'd to root, root would be in red (\e[0;31m in case you are interested). I guess since I did that I didn't enter any long commands...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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