My Backspace Key doesn't work!

The short answer:

Then, if necessary:

The long version:

Terminal emulation lets you use your PC to make a connection to another computer and interact with it as if your PC were a terminal, even though your PC is not really a terminal and almost certainly does not have the same kind of keyboard as the terminal it is emulating.

One of the most confusing aspects of terminal emulation is making the PC keys do what their keytops say they do. Many people find it quite surprising when the Backspace key doesn't backspace, the Arrow keys don't move the cursor, the Insert key doesn't insert, and so on. In general only the letter and digit keys on the main keypad can be depended upon to act as their labels suggest. The rest, well... each has its own story. This is the story of the Backspace key.

First some terminology. "Backspace" might (or might not) be the name of a key. For example, it is printed on the keytop of the large key at the upper right of main keypad on the PC 101 keyboard. On the DEC keyboard, the same key is labeled with a symbol (<X]) instead of a word.  "Backspace" is also is the name of an ASCII control character (ASCII value 8), which might or might not be associated with the Backspace key. "Backspace" is also an abstract concept relating to computers, terminals, and typewriters, having at least two distinct meanings:

To confuse matters even further, your keyboard might have keys other than Backspace that suggest a destructive backspace capability. For example, PC keyboads include both a "Del" and "Delete" key and one or two Left Arrow keys in addition to the Backspace key. These are strictly for local PC functions and not, in general, for sending characters to the host (but of course in Kermit you can map them to do whatever you want).

To cause a destructive backspace operation, the terminal must send an appropriate code to the host, and the host must reply with appropriate terminal-specific codes to move the terminal's cursor and remove the unwanted character. Unfortunately, different hosts and applications use different characters (or sequences) for destructive backspace (and of course, different terminals use different codes for screen formatting). The terminal emulator, Kermit or otherwise, has no way of knowing what host or application you are using, or how it is configured, and therefore no way of knowing what to send when you press the Backspace key.

Of course, Kermit's Backspace key must send something "out of the box", i.e. in the absence of specific instructions from you. This is default backspace assignment. Each emulation (VT100, Wyse 60, Televideo, etc) has an appropriate default assignment, namely what the corresponding key on the real terminal sends.

Therefore, it should be sufficient to inform the host you are connected to about your terminal type, and then it should expect the destructive backspace code that is associated with that terminal. In practice, however, this is rarely enough. In Unix(*), for example, the terminal driver has no connection with the terminal database, so setting or changing your terminal type in Unix has no effect on the characters it uses for destructive backspace (or other forms of editing, such as word and line deletion).

For most emulations Kermit uses one of the two most likely destructive backspace values, and in fact the one that is defined in ASCII to be destructive backspace, in most cases Rubout (RUB), also known as Delete (DEL), character number 127, which sometimes is displayed as "^?". Lest anyone believe this is a frivolous choice, we quote from American National Standard X3.4-1977, Section 5.1, Control Characters:

(Certain other emulations have their own defaults. For example Data General DASHER terminals use Control-Y for character deletion, because that is what Data General operating systems such as AOS/VS expect.)

What happens if the wrong choice is made? If Delete is chosen but is not the host's destructive backspace character, it is likely to:

If Backspace is chosen but is not the host's destructive backspace character, it is likely to:

Even when the host terminal driver uses a specific character such as Backspace for erasure, this does not guarantee that all applications also use it. One well-known case in point is EMACS, which -- in effect -- replaces the terminal driver with its own; in EMACS, control-characters are used as commands: Ctrl-H for Help, Ctrl-B for (cursor) Back, Ctrl-F for (cursor) Forward, etc. If you find EMACS's key definitions disconcerting, you can change them, e.g.:

  (define-key global-map "\^h" 'backward-char)                 ; nondestructive
  (define-key global-map "\^h" 'backward-delete-char-untabify) ; destructive

Select an Appropriate Terminal Emulation

The first step in making your Backspace key behave as expected is to choose an terminal emulation in Kermit that is appropriate for the computer your are connecting to, and then (if necessary) tell your host what kind of terminal Kermit is emulating. The command for choosing a terminal emulation in Kermit is:


Type a question mark (?) in place of the name to get a list of the available emulations. Here are some examples:

  Host Operating System        Terminal Type(s)
  (Open)VMS, RT11, RSX, ...    VT100, VT102, VT220, VT320
  Digital Unix, Tru64, Ultrix  VT100, VT102, VT220, VT320
  BBS's                        ANSI-BBS, AVATAR
  AOS/VS or DG/UX              D210, D215, D217, D463, D470
  Stratus VOS                  TVI950
  Linux                        LINIX
  Unixware                     AT386
  HP-UX                        HPTERM, HP2621A
  AIX                          AIXTERM, HFT, IBM3151
  SINIX                        SNI-97801, BA80
  BeOS                         BETERM
  QNX                          QNX, QANSI
  Most other UNIX              VT100 or VT102
  3270 protocol converters     VT100, IBM3151, Heath-19

When the most appropriate emulation is not available, most hosts also support VT100 and/or Wyse 50 or 60.

Inform the Host of Your Terminal Type

The command for telling your host what terminal type you have depends on the host operating system and, in the case of Unix, also on the shell. Some examples (for the DEC VT100 terminal type):

  set terminal /device vt100   (VMS, manual)
  set terminal /inquire        (VMS, automatic)
  term vt100                   (Unix if it has a 'term' command)
  export TERM=vt100            (Unix ksh or bash)
  setenv TERM vt100            (Unix csh)
  TERM=vt100 ; export TERM     (Unix sh)

After that, if the Backspace key still does not work, you have two choices:

Well, sometimes three choices. If the Backspace key sends the DEL character but the host wants the Backspace character, you can type Ctrl-H (hold down the Ctrl key and press the "h" key) instead of using the Backspace key.

Changing What Kermit's Backspace Key Sends

Kermit's SET KEY command lets you redefine the Backspace key (or any other key) to send whatever you want it to send (or to take any other actions).

The SET KEY command has two operands: a unique identifier for a key or key combination, called a keycode, and the value or action to be assigned to the key, called the definition:

  set key keycode definition

In Kermit commands, a keycode is a number preceded by a backslash. Keycodes are likely to be different for different operating systems, keyboards, and/or Kermit programs. In particular:

  Program            Keycode for Backspace Key
  MS-DOS Kermit               \270
  Kermit 95                   \264

(You can find out the keycode of any key or key combination by giving the SHOW KEY command. Kermit prompts you to press a key; you can press any key or key combination and Kermit tells you the keycode.)

As noted above, the characters most commonly used by terminals to send a destructive backspace command to a host computer are single ASCII control characters: Delete and Backspace. Control characters are entered into SET KEY and other Kermit commands by their numeric ASCII value, preceded by backslash (which tells Kermit that these are character codes, rather than literal digits). Here are the characters used for destructive backspace, in decreasing order of likelihood (numbers are shown in decimal):

  Character Name         Alternative Name    ASCII value
  Delete (DEL)             Rubout (RUB)           127
  Backspace (BS)           Control-H (^H)           8
  End of Medium (EM)       Control-Y (^Y)          25
  Number Sign (#)          Pound Sign              35
  Cancel Character (CCH)   (7-bit) ESC T        27 84 
  Cancel Character (CCH)   (8-bit)                148

(Number sign was used on very old Unix systems that were accessed from Teletype hardcopy terminals; this original Unix default is still found here and there. CCH is an 8-bit (C1) control character from ISO 6429, which has a 7-bit coding as the sequence ESC followed by the letter T.)

Now let's put all this together to show the possible combinations:

  Action                   Kermit 95              MS-DOS Kermit    
  Backspace sends DEL      set key \264 \127      set key \270 \127
  Backspace sends BS	   set key \264 \8  	  set key \270 \8
  Backspace sends EM	   set key \264 \25 	  set key \270 \25
  Backspace sends '#'	   set key \264 \35 	  set key \270 \35
  Backspace sends CCH	   set key \264 \148	  set key \270 \148
  Backspace sends ESC T	   set key \264 \27T	  set key \270 \27T

Of course other arrangements are possible too. Remember, you can assign any definition you want to any key or key combination. Some people might prefer to have Backspace always send DEL and (say) Shift-Backspace or Control-Backspace always send Ctrl-H (or vice versa). Example for K95:

  set key \264  \127      (Kermit 95: Backspace sends DEL)
  set key \1151 \8        (Kermit 95: Ctrl-Backspace sends BS)

Where do I put these commands? You can give SET KEY commands at the Kermit prompt, or you can put them in your Kermit customization file: MSCUSTOM.INI for MS-DOS Kermit; K95CUSTOM.INI for Kermit 95.

In Kermit 95, if you use the Dialer to make connections, you can also choose the Backspace-key action for each connection on the Keyboard page of the Dialer notebook for that connection.

Changing What the Host Expects

In the days of real terminals, there was no way to change what a terminal's Backspace (or equivalent) key sent. Therefore host operating systems such as Unix(*) that did not require a certain kind of terminal for access had to provide a method for adapting to different terminals.

Other host operating systems (such as VMS) always expect the same character for destructive backspace and you can't change it; in the VMS case, you simply have no choice but to configure your emulator to send DEL.

Unix hosts, however, let you change your editing and interruption characters (and much else besides) with the stty command. The particulars of this command vary greatly from one Unix variety to another, so you'll need to view the documentation by typing one of the following commands at the Unix shell prompt:

  man stty
  info stty

Here are a few examples:

  Operating System   View Settings    Change to BS      Change to DEL  
  Digital Unix 4.0   stty             stty erase ^h     stty erase "^?"
  HP-UX 8.00         stty             stty erase ^h     stty erase "^?"
  HP-UX 10.20        stty             stty erase ^h     stty erase ^?
  IRIX 6.5           stty -a          stty erase ^h     stty erase ^?
  Linux              stty -a          stty erase ^h     stty erase ^?
  SCO OSR5           stty             stty erase "^H"   stty erase "^?"
  SINIX 5.42         stty             stty erase "^h"   stty erase "^?"
  Solaris 2.5.1      stty -a          stty erase ^h     stty erase ^?
  SunOS 4.1          stty all         stty erase ^h     stty erase ^?
  Ultrix 4.3         stty all         stty erase ^h     stty erase "^?"
  Unixware 7.0       stty             stty erase ^h     stty erase ^?

Quoting requirements might vary from shell to shell (sh, ksh, bash, tcsh, etc). When in doubt use doublequotes as shown in many of the examples above. Note that in all cases above, the "^" character is "circumflex" or "caret", normally produced by typing Shift-6. In other words, "^h" in an stty command is circumflex followed by the letter "h", not Control-H itself. Also note that case might be significant in the control-character letter name: "h" or "H".

*Remember, "Unix" is a generic term covering dozens of specific operating systems, such as Linux, FreeBSD, AIX, HP-UX, Solaris, and lots of others.

Links to related info at other sites (likely to change or disappear at any time):

[ Kermit FAQ ] [ C-Kermit ] [ Kermit 95 ] [ MS-DOS Kermit ] [ Kermit Home ]

The Kermit FAQ / The Kermit Project / Columbia University / / 27 Apr 2001