1

Recently while working in Putty logged into my Fedora system I have started getting random ~ characters on my shell. Additionally, while I am editing in VIM I'll have characters randomly change to upper case. This only happens while I am logged int using Putty. I've never had this happen before so I am wondering if an update to Fedora has turned on some sort of keep alive feature in SSH that is causing this. I re-installed putty and trashed my preferences just to be sure. I'm not sure where to start digging to find the culprit. Any pointers?

2 Answers 2

2

It looks like you're typing a function key that sends an escape sequence that isn't recognized on the remote side. Many function keys generate escape sequences that end with the ~ character, e.g. \e[3~ for the Del key (where \e is the escape character). See How do keyboard input and text output work? (the part about input in the section about text mode applications running in a terminal) for more information about function keys in terminals.

If your shell and vim on the remote side don't recognize this escape sequence, they'll eat up \e[ (prefix of a recognized sequence), beep on 3, and treat ~ as an ordinary character.

At the shell prompt or in Vim insert mode, press Ctrl+V then the function key in question to see what it inserts. You may then want to create a binding for it: for bash, with the bind builtin in ~/.bashrc (example) or in ~/.inputrc (example); in vim, with map!, e.g.

map! <ESC>[3~ <Delete>

(Note that this example is preconfigured, you need to find out which key is not recognized on your system and adjust the escape sequence and key name accordingly.)

1

This is not a definitive answer, just a suggestion.

I had the same problem (not Putty but ssh from linux) and found that ssh_config has an option

EscapeChar ~

which I changed to

EscapeChar none

If Putty has some similar-looking config option, try to adjust it.

2
  • Interesting. I could not find anywhere to set this in the PuTTY client. I wonder if I should be setting this on the server? Looking at the man pages, I don't really understand exactly what the EscapeChar setting is for.
    – Nate
    Mar 7, 2014 at 22:41
  • It's to communicate commands from client to server that don't go to the remote shell. Like ~. terminates connection. Unfortunately this sometimes messes up normal input, at least in my case it broke arrow keys on the keyboard. However, there may be another problem here - terminal type and text encoding. If you use unicode, check both sides. Check also the terminal type and test what happens if you change it (echo $TERM).
    – orion
    Mar 7, 2014 at 22:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .