I have SSH'd into a gateway computer and then from there SSH'd into another computer. Every time I click on backspace the entire line gets deleted...

Using stty -a gives me the following (partial excerpt):

enter image description here

As you can see, backspace ("^?") is binded to erase, so I would expect using it to erase only a single character. Yet for some reason, it is behaving like ^U, where the entire line is deleted... As you can see below, as soon as I press backspace, the "^?" character is sent and the entire line is deleted despite it being mapped to erase not kill...

enter image description here

There are many similar questions already posted but none of those solutions work here since stty already maps to erase. (i.e. this)

I'm using bash.


The clue is in intr = ^?. When you hit Backspace, the shell receives SIGINT from the terminal and clears the command line. I can easily replicate the problem by running stty intr ^?.

Usually it's intr = ^C, which means Ctrl+c triggers SIGINT. Run this:

stty intr ^C


  • In the above command you can type ^C literally as two characters: ^ and C; stty should understand.
  • To fix the Backspace it's enough to set intr to anything but ^?. E.g. you can set it to nothing (undefined) by invoking stty intr ''. Still ^C should be your first choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.