Submit your Linux news story here.

How Linux and Unix erases character when you type a backspace while entering text

Interesting read about how Unix erases things when you type a backspace while entering text:

Yesterday I mentioned in passing that printing a DEL character doesn’t actually erase anything. This raises an interesting question, because when you’re typing something into a Unix system and hit your backspace key, Unix sure erases the last character that you entered. So how is it doing that?

The answer turns out to be basically what you’d expect, although the actual implementation rapidly gets complex. When you hit backspace, the kernel tty line discipline rubs out your previous character by printing (in the simple case) Ctrl-H, a space, and then another Ctrl-H.

Comments on this entry are closed.