Dan Mick's Little Shop of Hints

« Dell USB keyboard... | Main | UDP process finder »
20061020 Friday October 20, 2006

Making backspace be your default delete character

One consistently-annoying thing about Solaris is the default terminal control-character settings, which cause Backspace *not* to erase a character in most shells (without someone somewhere executing an "stty erase ^H" to fix it up). I'm not going to claim that the default is rational, or try to speculate about where it arises, although I will say that it's being looked at.

However, today, we discovered that it's relatively easy to change; the initial control-character settings are set up by the ldterm module (the "line-discipline" is the one that establishes all the normal character-editing modes that many shells use when using "cooked-mode" terminal I/O). ldterm, it turns out, reads them from a property in the /kernel/drv/options.conf file, called ttymodes. It's encoded, but it represents the full termio settings, as stty -g would output them. The default looks like this:

ttymodes="2502:1805:bd:8a3b:3:1c:7f:15:4:0:0:0:11:13:1a:19:12:f:17:16";

If you change that 7f (the ASCII code for Del) to 8 (the ASCII code for Backspace), and reboot, then Backspace works as you expect, as soon as you log in, in all shells, thank you very much, the way God intended. ( Oct 20 2006, 05:34:12 PM PDT ) Permalink Comments [4]

Comments:

This is just great! I'm off to put this into my Solaris build pronto!!!

Posted by UX-admin on October 21, 2006 at 01:47 AM PDT #

What's so bad about occasionally typing "stty erase ^H intr ^C"? I type that in my sleep. At most customer sites I have to exec my favorite shell over that korn shell pig anyway... :-)

Posted by Volker A. Brandt on October 21, 2006 at 08:33 AM PDT #

Oh man. Solaris is sooooo user-unfriendly and you just made my life as a solaris-newb so much easier! Thanks! That ought to be tip of the year.

Posted by boniek on October 21, 2006 at 07:41 PM PDT #

[Trackback] There are several fixes for “^H^H^H^H” on Solaris, but Dan Mick has found a fix that I had not seen before. You can simply replace 7f with 8 in the ttymodes property located in /kernel/drv/options.conf. I have not tested this fix. Two oth...

Posted by engrowe.com on October 22, 2006 at 05:40 PM PDT #

Post a Comment:

Comments are closed for this entry.

Calendar

RSS Feeds

Search

Links

Navigation

Referers