in Terminal: Backspace works, Delete doesn't

I've just started playing with a new Mac Mini. So it's pretty much in "from the warehouse" condition. In Terminal, though, I seem to be missing something.

When I type some text, and hit the BACKSPACE key (<---), it works as I expect it to. It removes the character to the left, and moves left one space.

However, when I type some text, and hit the DELETE key (Delete), it inserts a tilda (~) where the cursor was.

In "Window Settings" -> Keyboard -> "Key Mappings", I see that an entry for "del (forward delete)" which is set to the "\033[3~".

If this helps, on the cmd-line, running 'stty -a' I get the following:

epsilon3:~/tmp jeff$ stty -a
speed 9600 baud; 36 rows; 111 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;


I've looked through this topic, as well as trying to Google the answer, and also consulted a "Mac Genius" at the local Apple store. Since I'm not using an Apple keyboard, I thought it might be related to that fact, but trying this an a Mac Mini with an Apple keyboard at the Apple store, the guy helping saw the same results.

End result: he did not have a solution.

I would appreciate any help in resolving this.


Mac mini, iMac (dual core), iMac (original), PowerMac G3 Mac OS X (10.4.6) I do Linux, BSD, ...un*x...

Posted on Jul 3, 2006 6:55 PM

Reply
2 replies

Jul 4, 2006 12:30 AM in response to jack-of-all

Hi jack-of-all,
If you're talking about editing a command in the command line, your issue is not necessarily one with your terminal but can be address with your shell. You haven't said which shell that is but "stock" configuration suggests that the shell is bash. You can find out with the command:

echo $SHELL

If it is bash, the following command will fixed your problem if your description of your keyboard layout was accurate:

bind '"\e[3~": delete-char'

However, that will only affect the shell in which you executed the command. To have it apply to all shells, you would have to put the command in a shell startup script, like ~/.bashrc or ~/.bash_profile, or both. It might work to use just the latter if you only use one type of terminal.

The process by which the bash shell invokes scripts at startup is described in the INVOCATION section of the bash man page. In reading that, it usually helps to know that a "login shell" is the first one started after you login the computer.

There is a chance that this can be fixed via the terminfo mechanism but I know very little about it. There is a tilde in the "Apple_Terminal" terminfo database. If you set your TERM environment variable to Apple_Terminal, it might fix the delete key problem.
--
Gary
~~~~
Q: What's tiny and yellow and very, very, dangerous?
A: A canary with the super-user password.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

in Terminal: Backspace works, Delete doesn't

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.