Screen -- having more than one shell in a window
From Linux Solutions
to be able to have more than one shell in one and the same window you need to start screen like this:
screen
(If there is a greeting text of screen you can press enter to go to the shell)
Now, you see a normal shell
You an open a new shell session with C-a C-c (Press Control+a and than Control+c)
Now you're inside of the new shell
You can open more shells if you want
You can go to the first shell with C-a 0 (Press Control+a and than 0) to the second with C-a 1 and so on
If you press C-a 9 and you do not have this shell, it will show you all available shells.
With C-a C-a you can go to the last shell.
You can detach the screen from the window with C-a d . This means, that the screen is not longer shown in your window but still in existence. You can re-attache to it with the command
screen -x
If there are more than one screen-sessions open, you get a list. eg.
There are several suitable screens on: 4907.pts-21.LBlacky (Detached) 5084.pts-21.LBlacky (Detached) Type "screen [-d] -r [pid.]tty.host" to resume one of them.
Than you can attache to on of these screen-sessions with e.g.
screen -x 4907.pts-21.LBlacky
If one screen is already attached, than you get something like this:
There are several suitable screens on: 4907.pts-21.LBlacky (Attached) 5084.pts-21.LBlacky (Detached) Type "screen [-d] -r [pid.]tty.host" to resume one of them.
and you can attache to an screen which is already attached:
screen -x 4907.pts-21.LBlacky
Than, both of the attached windows will work inside of the same screen session! Thats nice if you work with someone together on the same project.
Beare in Mind:
C-a is used to controll screen and cannot be used for the shell or for other programms.
You cannot scroll inside of a screen session.
Andreas B.M. Hofmeier.