In this article we will discuss how to tackle situation when Backspace Key Doesn’t Work In UNIX
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.
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
emacs etc.) have their own key bindings (defined in
~/.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 ^?
Now the backspace/erase key would work as expected.