17

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?

25

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.

| improve this answer | |
  • This should be written as <kbd>Ctrl</kbd><kbd>a</kbd>,<kbd>'</kbd> and <kbd>Ctrl</kbd><kbd>a</kbd>,<kbd>?</kbd> 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 8: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.

| improve this answer | |
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.

| improve this answer | |
  • 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 ". – RonakG Oct 4 '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 4 '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 7 '15 at 22:42

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