Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use the f-keys to switch windows on GNU Screen/PuTTy, but I can't get it to work.

This is my current .screenrc:

bindkey -k k1 select 1
bindkey -k k2 select 2
bindkey -k k3 select 3

Changing the PuTTy keyboard options to "XTerm R6" did not work. I also don't know how discover what keycode is being received by screen when I press a key on Putty.


Problem solved! Turns out I had to close and reopen the screen session for the configuration to take effect (I was detaching and reattaching).

My current .screenrc is:

bindkey "\033OP" select 0
bindkey "\033OQ" select 1
bindkey "\033OR" select 2
bindkey "\033OS" select 3
bindkey "\033[15~" select 4
bindkey "\033[16~" select 5
bindkey "\033[17~" select 6
bindkey "\033[18~" select 7
bindkey "\033[19~" select 8

And PuTTy is set to VT100+.

share|improve this question
Do you want to change the TTY? Like you do with ctrl+alt+fn? – criziot Jul 6 '12 at 18:54
@criziot No, I want to change windows inside a GNU Screen session – lzm Jul 6 '12 at 18:59
Sorry. I miss the "screen" part. Maybe this can help. – criziot Jul 6 '12 at 19:03
That helped (ctrl-v), but I still cant get it to work. I also tried the instructions here with no success. – lzm Jul 6 '12 at 19:13
Nice you found a solution. But don't put it the in the Question. Answer your own question. – criziot Jul 6 '12 at 21:08

First, you need to figure out what your F1 key produce. I used emacs to do that.

  1. Login your system remotely with putty
  2. Run screen, and then
  3. run emacs -nw
  4. switch to *scratch* buffer (or whatever)
  5. Hit C-q F1 (C-q is quoted-insert and this will puts exact byte you get from F1 key)
  6. Copy that string to your .screenrc

My system, putty on windows accessing Debian unstable amd64 with screen 4.1.0~201203, got ^[[11~, so I put

bindkey "^[[11~" select 1

in my .screenrc and it seems to work.

Hope this helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.