Environment for this post
I am mainly working with screen in either Cygwin or Backtrack 5 R2, so if you do not have screen available for your distribution, find a repository which houses the application and download/install.
What is screen?
The screen man page states that "Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Each virtual terminal provides the functions of a DEC VT100 terminal and, in addition, several control functions from the ISO 6429 (ECMA 48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and support for multiple character sets)."
Basically screen offers the user multiple windows to manage terminal sessions and saves your processes during initialization.
To initialize screen, perform the following:
[ Wed Aug 29 10:06 @ ~ ]$ screen
Depending on how screen is setup, the user may be prompted with a text message, for example:
You are now inside of a window within screen. This functions just like a normal shell except for a few special characters. Screen uses the command "<CTRL>-a" as a signal to send commands to screen instead of the shell. To get help, just use "<CTRL>-a" then “?”. You should now have the screen help page.
Multiple windowsTo open a new window, use the following keyboard sequence "<CTRL>-a" then "c". This will create a new window for you with your default prompt. You can create several windows and toggle through them with "<CTRL>-a" then "n" for the next window or "<CTRL>-a" then "p" for the previous window. Each process will keep running while your work elsewhere.Leaving or DetachingThere are two ways to get out of screen. The first is just like logging out of a shell. You kill the window with "<CTRL>-a" then "k" or “exit” will work on some systems.
The second way to leave screen is to detach from a window. This method leaves the process running and simply closes the window. If you have really long processes, you need to close your SSH program, you can detach from the window using
"<CTRL>-a" then "d". This will drop you into your shell. All screen windows are still there and you can re-attach to them later.AttachingTo continue with the process that you were last running in screen, perform the following to list the current detached sessions:
|When using the "<CTRL>-a" then "k" command, the user will be prompted with a option to "Really kill" the window.|
To create a new screen with the name screen_test, use:
To reattach to a session, perform the following: