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 use bash shell

$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
$

Sometimes, when typing a command on the prompt that is pretty lengthy and does not fit in the current line, instead of displaying the extra characters on the next line, bash starts again on the current line.. replacing the characters that were there and making a mess.

what should happen :

|---------------------------------------------|
| $ my big long command takes a lot of argumen|
| s and does not fit in a single line         |
|                                             |
|---------------------------------------------|

what happens instead :

|---------------------------------------------|
| s and does not fit in a single linef argumen|
|                                             |
|                                             |
|---------------------------------------------|
  • The issue is intemittent
  • If I resize my shell window to really small width, normal behaviour is restored

Does anyone have any idea what is happening here?


$ echo $TERM
xterm
$ echo $PS1
\[\e[30m\][\t]\[\e[0m\]\[\e]0;\w\a\]\[\e[30m\][\W]$
$
share|improve this question
    
What terminal emulator are you using? What is TERM set to? Do you have any color or other formatting sequences in your PS1? –  Dennis Williamson Jan 8 '11 at 18:38
    
@Dennis: updated. –  Lazer Jan 8 '11 at 18:50
    
What terminal emulator are you using (PuTTY, gnome-terminal, etc.)? –  Dennis Williamson Jan 8 '11 at 19:20
    
@Dennis: I am not sure. I VNC to the machine to use it. –  Lazer Jan 8 '11 at 19:50
2  
Try shopt -s checkwinsize or put it in your ~/.bashrc. (The command makes bash recheck the window's size every time the prompt is displayed.) –  grawity Jan 8 '11 at 20:08
show 1 more comment

1 Answer

Your shell is getting confused about the width of your terminal. Whenever this happens an eval `resize` should reset everything properly.

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.