Articles

Grid view in GNU Screen

In Unix on 04/03/2010 by pier0w Tagged: , ,

Screen is a brilliant program that I personally think should be merged into all terminal emulators and ssh. One of it’s great features is it’s ability to split the screen up into a grid of buffers that can contain views to different terminals or application output.

To do this first start up a screen say with the name “Split”:
# screen -S Split

Now that you have a screen session running type “hello” into the prompt just so you know this is your first window then create a new window by pressing CTRL-a then c. You will know that you are now in a new window because the hello text will no longer be visable.

    CTRL-a, c – Create a new screen window.

You will now have two windows open and can switch between them by pressing CTRL-a then n or SPACE to move forward through them or CTRL-a then p or BACKSPACE to move backwards through them.

    CTRL-a, n – Move to the next screen window.
    CTRL-a, SPACE – Move to the next screen window.
    CTRL-a, p – Move to the previous screen window.
    CTRL-a, BACKSPACE – Move to the previous screen window.

Now create two more windows by pressing CTRL-a then c two more times.

Now that we have four windows open it is time to split up the screen. To split the screen horizontally press CTRL-a then SHIFT-s. You will now see a white line across the screen with your current window on the top and nothing on the bottom. On the bottom is an empty buffer, screen does not assume that you will want a new terminal opened in the new buffer so leaves it completely empty, you will have to tell screen what to put in it. To do this move into the new buffer with CTRL-a then TAB. Now select the second window with CTRL-a then 1. Screen numbers the windows from 0 upwards.

    CTRL-a, SHIFT-s – Split the screen horizontally
    CTRL-a, TAB – Move to the next buffer.
    CTRL-a, – Show the selected window.

You should now be able to see two terminals running one above the other. Move back to the first buffer with CTRL-a then TAB, make sure it is showing the first window with CTRL-a then 0, and split it vertically with CTRL-a then | (Pipe). Then move into the new buffer with display the second window with CTRL-a then 1. The second and third buffers will now be displaying the same window, you can prove this by typing some text, you will see it displayed in both buffers.

    CTRL-a, | – Split the screen vertically

Now to finish off move to buffer three with CTRL-a then TAB, display the third window with CTRL-a then 2, split the buffer vertically with CTRL-a then |, move into buffer 4 with CTRL-a then TAB, and lastly display the fourth window with CTRL-a then 3. Now you have a grid of four terminals all displaying in the same terminal.

On a side note you can change the name of a window with CTRL-a then SHIFT-a. Using this you could name the windows One, Two, Three, Four.

    CTRL-a, SHIFT-a – Rename the screen window.

Advertisements

Comments Off on Grid view in GNU Screen

%d bloggers like this: