Have you ever sat down at a terminal where the "erase" key
(the character that deletes the last thing you typed)
wasn't where you thought it would be? If you have, you know how
disorienting this can be!
command gives you a way of
changing the erase character (along with several others) so you can
restore some order to your world.
takes two kinds of input. If you want to give the command
is the key you
normally use for erase - BACKSPACE, DELETE, whatever - followed by
RETURN. This will do the trick, provided that the character you
type isn't already used for something. If the character is in use, or if you're
commands into your .login
to "spell these characters out." "Control" characters in
are allowed, but they aren't a great idea. If you like
to use the BACKSPACE key as the erase key, add the line below:
stty erase ^h
If you want to use the DELETE key, quote the
so the shell won't treat it as a
stty erase ^\?
That is: stty
lets you represent a control key with the two-character
is the literal key
is any single character.
You may need to put a
to prevent the
shell from interpreting it as a wildcard [and a
to prevent some Bourne shells from interpreting it as a
Of course, you're not limited to the BACKSPACE or DELETE
keys; you can choose any other key you want. If you want to use "Z" as
your DELETE key, type
. Just make sure you never want to type a real
lists functions that stty
Table 5.1: Keys to Set with stty
||Erases the previous character.
||Erases the entire line.
||Erases the previous word.
||Terminates the current job.
||Terminates the current job, makes a core file.
||Stops the current job (so you can put it in the background).
||Redisplays the current line.
The command stty everything
(for BSD UNIX) or stty -a
System V) shows all your current terminal settings.
characters aren't implemented on many System V versions.
As a historical note: the erase character was originally
, and the
kill character was originally
. These assignments go back to
the olden days (41.2
when terminals printed with real ink on real paper
and made lots of noise. However, I'm told that there are some modern
systems on which these settings are still the default.
Terminal emulators, editors, and other programs can fool around with
all of this stuff. They should
be well-behaved and reset your
terminal when you leave them, but that's often not true.
So: don't expect your settings to work within a terminal emulator;
they may, or they may not. And don't expect your settings to be
correct after you exit from your terminal emulator. Again, they may,
or they may not.
fools around (5.11
with key settings.
Therefore, in your
shell setup files (2.2