How to fix the backspace key in screen

I’m running Ubuntu 7.04 on my home server, and for some reason today the backspace key stopped working correctly in screen. Whenever I pressed it, it would give a ‘Wuff Wuff’ error! It turns out that screen was treating it like the delete key instead, and so since there were no characters in front of the cursor, it was giving an error. To fix this however, is relatively straightforward:

First edit your .bashrc file and add an alias for screen:

$ vim ~/.bashrc
alias screen='TERM=screen screen'

Then run:

$ source ~/.bashrc

And that's it!

One thought on “How to fix the backspace key in screen”

  1. This problem is caused the screen developers stubbornly sticking to the view that backspace should be non-destructive. Thus when your terminal, say xterm, sends a destructive backspace, screen treats it it like a delete. Here is the entry in their FAQ:

    ———

    Q: The cursor left key deletes the characters instead of just moving the cursor. A redisplay (^Al) brings everything back.
    A: Your terminal emulator (probably xterm) treats the backspace as “destructive”. You can probably change this somewhere in the setup. We can’t think of a reason why anybody would want a destructive backspace, but if you really must have it, add the line

    termcapinfo xterm ‘bc@:bs@’

    to your ~/.screenrc (replace xterm with the terminal type of your emulator, if different).

    ———-

    Add that line to /etc/screenrc and you can fix it system wide.

Leave a Reply

Your email address will not be published. Required fields are marked *