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'd like to fix this frequent problem where the shell on a remote server thinks my terminal's backspace key is ^? and sometimes it thinks it is ^H, and happens to be incorrect and outputs the wrong character when I press backspace. If I set it to ^H or ^? with stty erase ^H or stty erase ^? in my .bashrc file, and use some other terminal to access the server, it often ends up wrong. So I'm stuck having to manually type stty erase [whatever] to fix it when I notice the backspace key is wrong.

What I'd like to do is bind both ^? and ^H to backspace, because if I can do this, I can just add it to all of my .bashrc files, and it will certainly end this nightmare. Is this possible? If so, how?

share|improve this question

1 Answer 1

This page has all the information you will ever need on this issue; I suggest you read it. Now, if you are using bash, it should be enough to create an ~/.inputrc file containing these lines:

"\e[3~": delete-char
# this is actually equivalent to "\C-?": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H":beginning-of-line
"\e[F":end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~":beginning-of-line
"\e[8~":end-of-line

As an added bonus, they will make Home and End work as well.

share|improve this answer

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.