18

I use GNU Screen tool to keep my sessions alive on the system. To switch between windows I use Ctrl+a N where N is the number of the window. I want to use similar keystroke to access windows with numbers in two digits. As of now I have to go to window list by Ctrl+a " and then select the window.

Is there a way to achieve what I'm trying to?

Oliver Salzburg
  • 87,539
  • 63
  • 263
  • 308
ronakg
  • 446

3 Answers3

26

If you type Ctrl+a+' (an apostrophe), screen asks you to enter the window number. It's in screen help on the left side. Hit Ctrl+a+? to see the help.

dawud
  • 1,488
  • This should be written as Ctrla,' and Ctrla,? respectively or something similar to indicate not all three keys are pressed at the same time. Since that markup seems disabled in comments: That's Ctrl+a,' or Ctrl+a,? respectively. – valid May 31 '16 at 08:26
8

According to screen's manual page, you can add the following lines to your ~/.screenrc file:

bind -c demo1 0 select 10
bind -c demo1 1 select 11
bind -c demo1 2 select 12
bindkey "^B" command -c demo1

makes C-b 0 select window 10, C-b 1 window 11, etc. Alternatively, you can use:

bind -c demo2 0 select 10
bind -c demo2 1 select 11
bind -c demo2 2 select 12
bind - command -c demo2

makes C-a - 0 select window 10, C-a - 1 window 11, etc.

P. B.
  • 336
3

Well I don't know what your doing that actually needs 10+ processes to be accessible in one screen instance anyway, but you might just use ctrl-a n/p to go back and forth (which conveniently wraps around).

And consider just using 2 instances of screen ... or even a screen-in-screen

There is no way to switch directly to windows above number 9 as explained in the doc.

jpjacobs
  • 286
  • 2
    Having 9+ processes in Screen is not the case always but sometimes I do have 12-13 processes running and I need to watch them at the same time. Looks like I'll have to stick with Ctrl+a ". –  Oct 04 '11 at 15:03
  • 2
    you can have a split screen too. Which works nice if you want to have more processes open at the same time. Maybe Byobu could be useful too – jpjacobs Oct 04 '11 at 15:16
  • 2
    the initial comment is completely unnecessary. having more than 10 windows in screen for me is commonplace, I do different things in different directories in each and it's much more productive to have one window per task (watch logs, edit sources, run stuff, monitor results, etc). – msb Oct 22 '14 at 22:42
  • I sometimes open a separate window to each server of the same cluster, so it's rather common for me to have more than 10 windows. thanks. – Tagar Sep 07 '15 at 22:42