17

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?

4 Answers 4

19

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.

3
  • I do not have this option in either of the terminal tabs. Using v7.2 on Windows 8. May 6, 2016 at 17:16
  • This is not in the menus "Settings->configuration->Terminal". Is there a corresponding key that can be set in the MobaXTerm.ini file? Interestingly there is an option to disable that keyboard feature in the X11 tab of the settings -- but that's just for graphical applications rendered in the builtin x11 server.
    – init_js
    Jul 28, 2019 at 21:22
  • ah. the option's only in the settings for a given user session. not in the global settings. see superuser.com/a/1465094/525084
    – init_js
    Jul 28, 2019 at 22:43
5

In MobaXterm, there exists an option to change the behavior of the backspace key. (answer below is based on MobaXterm personal v11.1)

The option is called: "Backspace sends CTRL-H"

The option is only shown in the session-specific configuration, not in the global settings: Create/edit a new/existing user session of type SSH in Moba, and access its settings. Under the "Terminal Settings" tab, uncheck "Backspace sends CTRL-H", save, and reload.

Can the behavior be changed for all sessions? I haven't figured out a way to change the behaviour globally yet. MobaXterm uses Putty code underneath, which does have a corresponding toggle setting for the backspace key behavior, but unfortunately that`s not exposed to the global settings window in MobaXTerm. Not in the free version anyways.

The professional version of Moba does offer a separate configuration tool which shows more config options to you. I suspect this might translate into a MobaXTerm.ini setting. I can't verify.

Alternative: change the behavior on the server If you login with ssh <server> from a local terminal not attached to any user session, the global setting applies -- which is to send ^H. This causes some issues with editors, namely emacs, and anything else using readline like telnet. A workaround is to patch the terminal behavior on the remote site by issuing an stty command (on debian, this comes with package coreutils):

# interpret incoming ^H as backspace/erase
stty erase \^H

I don't recommend adding this to ~/.bashrc if you login via other sorts of terminals, however. So the user-session config key is a better approach.

3

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.

3
  • 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, 2015 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, 2015 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. Nov 1, 2015 at 1:38
0

Its been some time since this has been updated, but MobaXterm 21.3 changed a couple things:

  1. If you go to "Settings->configuration->Terminal", you will see there is a global setting now.
  2. If you change this behavior, be aware any already created sessions, will need to be manually changed if you desire their configurations to be the same. Per saved session "Settings->Terminal Settings Tab-> "Backspace sends ^H" uncheck here too.

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.