Skip navigation

Harald Markus Wirth


Page Content:

How to use screen

  1. ~/.screenrc
  2. Using Multiple Windows
  3. Starting a Shared screen Session
  4. Split Screen

~/.screenrc

startup_message off
multiuser on
acladd root
acladd <user name>
shell -$SHELL
source ~/.screen_layout
layout save def

Using Multiple Windows

Create a new window
^a, c
Switch between windows
^a, <number> (the initial screen has number 0)
Close a window
Quit any program and type "exit", "logout" or hit ^d

Starting a Shared screen Session

Type screen -S myscreen to start a screen session. If you did not yet create the ~/.screenrc, you can activate the needed settings by pressing CTRL-A and typing the commands preceeded by a colon:

^a:multiuser on[Enter]
^a:acladd <user name>[Enter]

You can detach from the session with ^a^d. You can reattach with screen -x. Attach to another session: screen -x username/sessionname. So, if you started a multiuser session as user "itsme", and you want to attach to that session as root, you type: screen -x itsme/myscreen. Also try screen -list.

Split Screen

Splitting the screen in half horizontally

Screen has the ability to split the window into two or more half horizontal windows. This feature will enable you, for example, to work in a half screen, while viewing the system resources ("top") in the remaining half.

To split the screen in two, first create two screen sessions. Then press ^a, S which will split the screen in half, giving you a session on the top that you're already using and a blank session at the bottom.

To move to the bottom half, press Ctrl+a, then the TAB key. This key combination will move the console cursor to the lower half. Once in the blank half, you have to set this bottom half of the screen to use one of the two earlier created sessions. To do this, press Ctrl+a, then " (shift+'). You will be presented with a list of available screen sessions, pick one using the arrow keys (be careful not to pick the one already at the top or you'll have a mirror console), and activate it by pressing Enter. Now type top and switch to the upper half by pressing again Ctrl+a TAB. You should now have a bash prompt waiting for commands in the upper half and system resources monitoring in the bottom half.

To return to full size screen, switch to the half you want it to remain and press Ctrl+a Q.

C-a :resize -h 10   # horizontal, vertical


Content Management:

μCMS α1.6