Backspace Key Doesn’t Work In UNIX

LINUX_www.basisguru.com

In this article we will discuss how to tackle situation when Backspace Key Doesn’t Work In UNIX

Symptoms:

As a basis consultant, we often need to edit many configuration files on operating system level.
We often complain the backspace key doesn’t work in UNIX.

In such cases we can try to configure tty driver such that the backspace key indeed functions the way we want i.e. delete previous character’ key.

Cause:

The standard Unix tty driver does not recognize a cursor, or keys (like the arrow keys) to move the current position, and hence does not have a command `delete current character’ either.

Note that many programs (like bashemacs etc.) have their own key bindings (defined in ~/.inputrc~/.emacs etc.) and are unaffected by the setting of the erase character.

Most Unix programs get their tty input via the kernel tty driver in `cooked’ mode, and a simple stty command determines the erase character.

How to tell Unix what character you want to use to delete the last input character:

We need to use stty command in linux.

% stty erase ^?
Backspace Key Doesn't Work In UNIX
stty erase

Now the backspace/erase key would work as expected.