Sometimes we have to connect our shell to the server for maintenance or just monitoring our remote work stuff. But there are some application that need an uninterruppable connection, if we’ve lost connection so the work too. For example, when we did some scp-ing or compiling a BSD based software or kernel, ouuuchh such a terrible things if we lost connection in our mid-work process.
So there is Screen formerlry GNU Screen, What is ‘Screen’?
“Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells” (http://www.gnu.org/s/screen/)
With the use of screen we wouldn’t lost our work when there is failed connection stuff. On the most POSIX Operating System, ‘screen’ is almost installed and ready to use. If there is no screen on OS, simply just download or install with your distro-way (apt-get, rpm etc)
To Use ‘screen’
Just type “screen” (without appostrophe) on terminal console
So the welcome screen of ‘screen’ will appear:
just Enter when ready to use ‘screen’ and we will already in ‘screen’ immediately. Then we could doing our works.
Some useful keyboard shortcut
Ctrl + A : initiate ‘screen’ command
Ctrl + A and press A immediately : change windows (act like alt-tab in normal wm)
Ctrl + A and press C immediately : create a new window
To resume a disconnected ‘screen’
type “screen -list” to list all available ‘screen’ session and status Detached/Attached
$ screen -list
Here is my ‘screen’ list for example
gti@opensolaris:~$ screen -list
There is a screen on:
1 Socket in /home/gti/.screen.
To connecting the detached shell type “screen -r”
$ screen -r 8936.pts-2.opensolaris
And we will ‘connected’ again🙂
To exit screen just type ‘exit’
so the “[screen is terminating]” message will appear
or just close the terminal :))