Long question: I'm trying to test my simple HTTP Server by Telnet-ing alot of requests and seeing how the server reacts. But when i make a typo and press Backspace to erase the previous character, MobaXterm sends ^H instead of removing the character from the string. When i press Shift+Backspace everything works the way i want it to, but after a while this gets very annoying... So, is there a solution that just changes the functionality of backspace?

Short question: Is it possible to make backspace delete a character instead of sending ^H?


MobaXterm also proposes a checkbox setting "Backspace sends ^H" that you can try to toggle (in MobaXterm global settings --> "Terminal" tab).

If you are using a saved session, you will have to edit this session, go to the "Terminal settings" tab and toggle the "Backspace sends ^H" checkbox.

  • I do not have this option in either of the terminal tabs. Using v7.2 on Windows 8. – rmf May 6 '16 at 17:16

The key labeled "backspace" is a matter of contention. Technically, it ought to send ^H simply because that is the name of the ASCII control character. Others differ, because their expectations have been affected by the history of this feature (see Why doesn't my delete key work?).

In a discussion where you say you are typing, the usual connotation (lacking clarification) is that you have started a terminal, then run a program within the terminal. For that case, there is a corresponding terminal initialization, e.g., using a shell and program such as stty. This is run on the local machine (where you are typing). MobaXterm provides stty since Version 3.2 (2011-05-30).

Given that, if MobaXterm sends ^H, your terminal initialization should use

stty erase \^H

See for example What does the command stty erase ^H do?.

On the other hand, you could have (not apparent in the question) constructed a situation where the terminal is started in a manner that precludes using stty to make the application and terminal consistent. Or you may have some other reason for changing the behavior of the backspace key. PuTTY (like xterm) provides two mechanisms for this:

  • one (originally implemented in rxvt) lets you use the shift modifier to toggle the code sent from "backspace" between ASCII backspace (BS = 8 = ^H) and delete (DEL = 127, often shown as ^?).
  • the other is the terminal configuration (a dialog setting in the Keyboard section of the Terminal section).

xterm provides a third mechanism which PuTTY appears to lack (see XTerm Control Sequences):

CSI ? Pm h
      DEC Private Mode Set (DECSET).
            Ps = 6 7  -> Backarrow key sends backspace (DECBKM).

If PuTTY did implement that, your application could set the behavior of the terminal directly. Rather, during initialization, PuTTY checks the initial state of its configuration and (depending on platform) also checks (like xterm) the terminal modes set in the device, and chooses a backspace versus delete behavior which you can accommodate or amend as noted.

  • Unless i'm not getting something, This is a command you would type in a Unix/Linux terminal, My HTTP Server is definitely not a Unix/Linux terminal. Read long question... – DutChen18 Oct 30 '15 at 5:00
  • Thanks for the clarification, i misunderstood your first answer. One last question: Where can i edit my terminal initialization and add stty erase \^H. My problem is already solved, but if i don't find an answer to this question, it will bug me untill i forget about it... – DutChen18 Oct 30 '15 at 22:19
  • MobaXterm uses bash; if you add your stty commands to the .bashrc in the starting directory for the terminal window, it will execute those in MobaXterm. Checking a copy now (personal edition 7.7)... it's set to use ^H. Pressing control+backspace sends ^?. There is no checkbox in this version for backspace, but using control+backspace works well enough. – Thomas Dickey Nov 1 '15 at 1:38

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.