The short answer to “why does the backspace key send $7F Delete rather than $08 Backspace” is “your terminal emulator emulates the VT220 terminal, and that’s how it behaved.
The reason you don’t need them is because linux always treats \n as newline in line processing and with icrnl enabled (by default) if your keyboard emits \r you will get \n before line processing.
Once upon a time, ASCII keyboards could often send a different character for the return keys on the number pad versus the “main” keyboard, or have a special “submit” or “send” key (instead of sending an escape sequence). Unix’s kernel-side line editor didn’t have much use for those keys, so users might configure stty to treat them as newlines rather than reconfigure their terminal (which they might use to connect to non-unix systems or to run interactive applications).
The short answer to “why does the backspace key send
$7F
Delete rather than$08
Backspace” is “your terminal emulator emulates the VT220 terminal, and that’s how it behaved.Controlling terminals is fraught with lore and near infinite exceptions.
The only surprise is that a definitive tome is not listed.
I think the closest you can get to a definitive tome is the termcap/terminfo databases.
I wonder why there is an
eol
AND aneol2
and why both of them areundef
.stty
man page sayswhere the * before
eol2
indicates non POSIX settings; but it does not elaborate any more :(The reason you don’t need them is because linux always treats
\n
as newline in line processing and withicrnl
enabled (by default) if your keyboard emits\r
you will get\n
before line processing.Once upon a time, ASCII keyboards could often send a different character for the return keys on the number pad versus the “main” keyboard, or have a special “submit” or “send” key (instead of sending an escape sequence). Unix’s kernel-side line editor didn’t have much use for those keys, so users might configure stty to treat them as newlines rather than reconfigure their terminal (which they might use to connect to non-unix systems or to run interactive applications).
Ah makes sense, it is for backwards compatibility for very old nonstandard keyboards. Thanks :D