screen
~/.screenrc
startup_message off vbell off multiuser on acladd root acladd hmw shell -$SHELL defscrollback 99999 source ~/.screen_layout layout save def termcapinfo xterm* ti@:te@
^a
, c
^a
, <number>
(the initial screen has number 0)
^d
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
.
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
To save the current layout issue inside Screen:
$ rm -f $HOME/.screen_layout $ screen -X layout dump .screen_layout
To make it autoload:
echo source .screen_layout >> $HOME/.screenrc echo layout save def >> $HOME/.screenrc