Sometimes, my bash prompt wraps long lines incorrectly, such that I’m typing over my own prompt like this:
I used to just live with it, trying to remember what I already typed and counting characters if I was going back to change something. That made my Unix experience much more frustrating that it should’ve been, because executing this single command immediately resolved the issue:
kill -WINCH $$
What does this do? You’re basically telling bash that the window size has changed. It turns out that if you resize your terminal window, bash sometimes doesn’t notice the size change without you giving it an extra nudge. Without the correct window size in hand, bash can’t wrap your text correctly!
If that doesn’t solve your bash wrapping woes, then it may be because your prompt format is incorrect. (Yup, I’ve been there, done that.) To fix it:
echo $PS1to see what your prompt is.
Make adjustments and test drive your updated prompt by executing:
Save the version that makes you proud to be a shell user by putting the following in your
Have fun at the command line!