The Terminal Erase Character

What Is This File Called .noseterase?

This file is specific to XS4ALL shell access, using bash or zsh.

Having this file in your home directory prevents /etc/profile from setting the terminal erase character (which is how it should be).

What Is the Erase Character?

The terminal erase character is the character that, when received, will erase the character that was typed before it. You can view your current erase character by typing stty at the shell prompt.

The erase character is usually set to ^H (control-H, ASCII character BS, 8 decimal) or ^? (ASCII character DEL, 127 decimal). What it should be in any particular case depends entirely on the terminal (vt100, console, ...) or terminal emulator (xterm, windows telnet, ...) you're actually using.

It should also correspond to what gets send when you type the key called "Backspace", "Delete", or "<-" that is located just above the key marked "Enter" or "Return".

What Can Happen When The Erase Character Is Wrong?

Having the wrong erase character set can be a problem with some programs whose line editing depends on it (an example is vim in line mode). Instead of erasing the last-typed character, ^H or ^? (the actual erase character of your terminal) appears in the input.

Note that bash (the Bourne Again SHell command interpreter) is flexible enough to recognise both ^H and ^? as erase characters, so it normally handles an invalidly set erase character with grace.

What To Do To Set the Right Erase Character?

If your terminal character is not set right, then:

Can I Set the Erase Character in My ~/.login?

Of course you can, using e.g. stty erase ^H or stty erase ^?.

However, technically, it's not the right way. Inside a shell initialisation file, it is impossible to know for certain what the erase character should be, because you don't know from where you're logging into the system. You may say now that you always log in from home, but then one day you'll buy a new computer, or you log in via a friend's computer, and it stops working.

The superior solution is to rely on the login client (telnet, ssh, or rlogin) to tell the kernel what the erase character is. If it doesn't, install another login client, because yours is buggy.


Vincent Zweije