Super User is a question and answer site for computer enthusiasts and power users. 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

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
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

You must log in to answer this question.

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