The screen Reference Page

Starting screen

screen [ -options ] [ cmd [ args ] ]

If a command is not executed, screen simply runs a command shell. When the command is finished screen will exit.

When referring to an existing screen you can refer to it either by process id or by name. By default screens are named using the format, where tty is the terminal, and host is the host computer. You can choose to give the screen a different name using the -S command line option.

Command line arguments are case sensitive.

-ls List the screens that are currently running (does not start a new one)
-S name Create a new screen with the specified name
-r sid Reattach to an existing screen; fails if it does not exist
-R sid Reattach to an existing screen if it exists; if not create it
-d sid Do not start a new screen; detach one that is already running (e.g. if you left it attached to another terminal)
-d -r sid Reattach to an existing screen; if it is already attached to something detach it first, then reattach to it
-d -m Start the screen but do not attach to it (e.g. for a scheduled job)

Running screen

Screen commands always begin with ^A (Ctrl-A). You will notice there are more than one way to run some commands. For example, to run the detach command you can use either ^A d or ^A ^D. Commands are case sensitive (unless using the Ctrl key).

A single screen can contain multiple windows, each running its own shell. Windows are numbered starting at 0, and can be given their own title in order to help tell them apart.

When you reattach to a screen it only draws the current contents of the screen on the terminal; using the scrollbar to scroll up will not show you what came before. However, each window maintains a scrollback buffer to remember what was on the screen before. Although you cannot view this using the scrollbar, you can enter scrollback/copy mode which allows you to navigate the scrollback buffer using the cursor, as well as to copy text from the buffer.

? help – help screen; shows commands
d ^D detach – return to original command prompt; leave screen running in background
c ^C screen – create a new shell window
K kill – kill the current window; can also just exit the shell
p ^P prev – switch to the window with the next lower number (or to the largest if you are currently viewing zero)
n ^N next – switch to the window with the next higher number (or to zero if you are currently viewing the highest)
^V vbell – toggle the visual bell (screen flashes instead of beeping)
A title – allows you to type in a “title” for the current window
[ ^[ copy – enter scrollback/copy mode
While in scrollback/copy mode you can move the cursor around the screen using the arrow keys or page up/down. Using the cursor you can “scroll” up through the previous contents of the screen. You can also highlight text to be copied using the spacebar—press it once to mark the beginning of the text, and a second time to mark the end. The text will be copied, and you will exit scrollback/copy mode. To exit scrollback/copy mode without copying text press Ctrl-Space.
] ^] paste – paste any text copied from copy mode