Screen: Difference between revisions

From UMIACS
Jump to navigation Jump to search
Line 22: Line 22:


See the documentation linked in this page to see a full list of Ctrl-A commands (5.1 Default Key Bindings).
See the documentation linked in this page to see a full list of Ctrl-A commands (5.1 Default Key Bindings).
To start a long-running process:
'''screen'''
then run your process.
If you need to end your ssh session, but want the process to keep running detach it:
'''screen -d'''
If you want multiple sessions, name each session:
'''screen -d [enter a name]'''
When you ssh back in, reattach your session:
'''screen -r'''
If you have named your session:
'''screen -r [session name]'''


=== .screenrc ===
=== .screenrc ===

Revision as of 18:41, 17 October 2014

Introduction

GNU Screen, or "screen", is a window management program available on UMIACS UNIX hosts that splits a terminal into multiple windows that can each be used for a separate process. This can be very useful when a process will be running for a long time. The process is allocated to a virtual terminal created by screen, and it will run in the background while other terminals are being used or if the SSH session ends.

Usage

To invoke screen, simply use the following command: screen

Alternatively, to start a program with screen: screen vi program.c

This will invoke screen and, in the newly-created window, start editing the file program.c in vi.

Ctrl-A is the metacharacter for commands in screen; press it before every key command. Some useful commands in screen:

  • Ctrl-A + C (Creates a new window.)
  • Ctrl-A + d (detach from current session)
  • Ctrl-A + [0-9] (Switches to the window corresonding to the number, window 0 is the first window initialized by screen.)
  • Ctrl-A + " (Presents a selection of screen windows from which to choose.)
  • Ctrl-A + <SPC> / Ctrl-A + <BKSPC> (Switch to the next / previous window.)
  • Ctrl-A + k (Kill the current window.)
  • Ctrl-A + Ctrl-\ (Kill screen and all its windows.)

See the documentation linked in this page to see a full list of Ctrl-A commands (5.1 Default Key Bindings).

To start a long-running process: screen then run your process.

If you need to end your ssh session, but want the process to keep running detach it: screen -d

If you want multiple sessions, name each session: screen -d [enter a name]

When you ssh back in, reattach your session: screen -r

If you have named your session: screen -r [session name]

.screenrc

Similar to .bashrc, the file .screenrc in a user's home directory can be used to customize each screen session's startup behavior. Commands listed in this file will be executed upon starting screen. See the link to documentation on screen at the bottom of this page for more information about screen commands (5.2 Command Summary).

Useful Links