Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using ssh command from osx terminal to connect my centos remote server. If I type long string and want to go next line, the characters don't go to second line but come back the first line left side. And they overwrap prompt strings.

For example, I want to type like this.

[username@hostname ~] loooooooooooong command and the arguments that come

to second line

But it ends up like this.

to second linename ~] loooooooooooong command and the arguments that come

Is there way to avoid this over-wrapping?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

That usually happens if the prompt contains non-printing characters that are not surrounded with \[ and \].

So for example use PS1='\[\e[33;1m\]\W\[\e[m\] ' instead of PS1='\e[33;1m\W\e[m '.

share|improve this answer
    
Thanks! I was used like `GREEN="0;32" START_COLOR="\e[${GREEN}m" END_COLOR="\e[0m" PS1="${START_COLOR}[\u@SakuraVPS \W$]${END_COLOR}]" –  Tetsu Sep 23 '13 at 4:43
    
I rewrite is like GREEN="0;32" START_COLOR="\e[${GREEN}m" END_COLOR="\e[0m" PS1="\[${START_COLOR}\u@SakuraVPS \W$ ${END_COLOR}\]", then over-wrapping is solved. But another problem happens, when I hit a character and delete the charactor, then the prompt strings also deleted. why is that happens? –  Tetsu Sep 23 '13 at 4:54

I have this happen occasionally and the reset command (run on the remote host) usually brings back wrapped lines for me.

share|improve this answer

Your Answer

 
discard

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.