gnu-screen

Switch to last window in GNU Screen


I know how to list out the available windows in Screen using C-a " and/or C-a ', but how do you specify that you want to go to the very last screen without having to explicitly say so.

Like what I'm looking for is something like this:

C-a L

NOTE: I'm just asking whether screen supports this natively or if I'll have to write a bit of script in order to get this to work, also, tips and pointers for writing said script, if proved necessary, would be appreciated.


Solution

  • Assuming you have a window 0 (i.e., you haven't closed it), you can do

    C-a 0
    

    (select 0) followed by

    C-a <backspace>
    

    (prev), which switches to the previous window; if you're on the first window, it wraps around to the last.

    The prev command has several other default key bindings:

    C-a h
    C-a p
    C-a C-p