So this is an odd situation, especially since this is the (at least) third time I've installed Cygwin in a similar setup, and I've never seen this behavior before.

My setup: Windows 7; Cygwin, with MinTTy as my terminal, BASH as my shell; Microsoft Natural Ergonomic Keyboard 4000 v1.0

What's happening: when typing in a terminal, if I hit the DELETE key, all characters from the beginning of the line to the cursor's position are erased and replaced with "[3~"


  1. Open a terminal, type in some text, and position cursor, as below

    $ hello im just typing in the terminal

  2. position the cursor after "typ" and hit DELETE


$ [3~ing in the terminal

As I mentioned above, I've actually installed Cygwin on this machine before, with this same keyboard. The DELETE key WORKED before. I even use the same model keyboard with my laptop, which is running Win7 with Cygwin and minTTY in an almost identical setup. On my laptop, I never see this behavior.

Does anyone have ANY idea what I might need to do to fix this? I've googled around and can't find anything.

Thanks so much!

  • The keycode of the DEL key is \e[3~, whereby \e is the Escape control character. So it looks like Escape is somehow mapped to the the backward-kill-line readline command, with the remaining characters in the keycode then appearing on the command line. Have you got anything in your .inputrc or the various bash startup files that could do that? Do other keys such as the arrow keys work as expected? And what's the TERM variable set to? – ak2 Jul 2 '13 at 8:53
  • Argh; yep, that's probably it. I put the following line in my .inputrc: " Escape: backward-kill-line " I guess that's not doing quite what I thought it would :/ Thanks so much! – Nate Kennedy Jul 3 '13 at 11:46
  • Yep, it's an ancient problem with Unix terminals that the Escape keycode can't properly be told apart from the start of the keycodes for many other keys. Some programs such as 'vim' use a timeout to try to distinguish them, but that's not entirely reliable, and bash/readline doesn't even have that. – ak2 Jul 4 '13 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.