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.

My Bash prompt seems to be wrapping lines really inefficiently. Here is an example to show what I mean:

enter image description here

I would like the commands that I am typing to continue onto the next line if the command length exceeds the window size.

My PS1 variable in the bashrc file is:

PS1='\e[0;36m\u \W: \e[m';

Perhaps tweaking this will help?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Enclose the formatting sequences in escaped square brackets to let the terminal know that these characters aren't actually printed (for width calculations):

PS1='\[\e[0;36m\]\u \W: \[\e[m\]';

More details here in section Colors.

Edited to link to original submission on Meta, since whoever copied it to Blog.SU messed up pretty much everything.

share|improve this answer
add comment

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.