Screen is a utility that allows one console user to share their terminal with another. This is an excellent solution for training or administrative knowledge/task sharing.


Most distros have this installed by default, on Praxis you many need to:

root@host # emerge -pv screen
[ebuild  N    ] app-misc/screen-4.0.3  USE="-debug multiuser -nethack pam (-selinux)" 821 kB


Screen keeps a configuration in /etc/screenrc (generally). This can control the meta-command characters and other screen defaults. May want to adjust this file following these snippets.

defscrollback 5000
multiuser on
startup_message on

Screen to Resume / Place-Holder

In this scenario screen can be use to create a session that one can disconnect from and then re-connect to. Nice for usage of low-quality links or when switching locations/networks. Simply run screen, maybe give it a name. Then when you detach or the connection drops you can reconnect. Use the -S argument to name the session

# screen -S foobar
# echo $TERM

You can detach using Ctrl+a, Ctrl+d, or if the SSH connection drops you will be detached as well. To re-attach to that session simply -r with its identifier or name.

In screen the command Ctrl+a H will enable logging to screenlog.# in the current working directory. This is useful for session logging, or for perforing long system maintenance/troubleshooting to be able to replay.

root@host # screen -list
       20145.pts-0.carbon      (Attached)
        20232.foobar    (Attached)
2 Sockets in /var/run/screen/S-root.

# screen -r 1234.pts-0.root
# screen -r foobar

Screen Sharing

This is useful for UserA to share the screen with UserB in a teacher-student or mutual shared work-space. The first example is shared work-space, the second is teacher-student style.

First admin will login/ssh-in/what-ever to access a terminal and start screen with a session name (-S). The second admin/worker/user will connect and then use -x to attach to the same.

root@host # screen -S watch_me

This example is for teacher-student style, where the studet session is view-only. Multiple view-only session can be attached to this multi-user session.

root@host # screen -S watch_me
root@host # Ctrl+a :multiuser on
root@host # Ctrl+a :acladd UserA
root@host # Ctrl+a :aclchg UserA -w "#"
UserA@host # screen -x root/watch_me

See Also