Whenever I log into my machine and I try to hit the backspace key, it does not erase characters like I expect it to. Instead, it prints a ^H for each keypress. How do I erase?

A: Solaris gurus don’t ever make mistakes. That’s why the backspace key doesn’t work! KIDDING!

Seriously, though — similar to this solution, you should only be getting this error if you are consoled into a machine via a null modem cable, if you have telnet-ed into a remote machine or if you are using a Sun machine with a Sun keyboard and mouse in text mode (no GUI, for example if your video card driver is not yet installed.) To fix this, you need to use the stty command to change the setting for ‘erase’.

SUMMARY:

  1. Use stty command to change setting for ‘erase.’
  2. Test for desired result.
  3. Make the change permanent.

DETAILED:
1) Use stty command to change setting for ‘erase.’

Type:

stty erase ‘^H’

You can use either single or double quotes (i.e. ‘^H’ or “^H”), but be sure to close with the same quotes you open with. Like the old joke: “You can bring your wife or girlfriend, but not both.” Maybe not. Laugh anyway.

Another way to achieve this same result is to type:

stty erase [press backspace]

A bit of explanation: you’re going to type stty erase just like you did above, but this time press space after erase and then press the backspace key. The line will end up looking similar to the first example, except without quotes around the ^H. When it’s done that way, it is fine – however, if you decide to type it manually, you need to enclose it in quotes.

2) Test for desired result.

Type something on a line and then press the backspace key to erase it. It works, right? Feels good, doesn’t it?

3) Make the change permanent.

Again, just as with this solution, the change you just made is temporary. When you log out and log back in, pressing the backspace key will result in the same ^H behavior that you were experiencing before. If you would like to make this change permanent, you will need to add the following line to your shell configuration file:

stty ease ‘^h’

PS: Don’t forget to stop by AnySystem.com for all your Sun hardware and consulting needs.

Comments are closed.