Using screen

From Cosmin's Wiki

Jump to: navigation, search

Home > Linux how to's > Using screen



screen is a terminal multiplexor that runs several separate "screens" on a single physical character-based terminal. Each virtual terminal emulates a DEC VT100 plus several ANSI X3.64 and ISO 2022 functions. Screen sessions can be detached and resumed later on a different terminal.

Screen also supports a whole slew of other features. Some of these are: configurable input and output translation, serial port support, configurable logging, multi-user support, and utf8 charset support.

Installation

Installing screen is more than simple. From your command line just type:

# aptitude install screen

and the system does the rest for you.


Basic usage

To start a command line based program within a virtual ’screen’ prefix that command with screen, such as:

screen irssi

Once that has loaded you can detach the virtual screen for later use by pressing ctrl-a d. To reattach that screen type screen -r (or, if the screen was somehow not completely detached previously you would use screen -dr).


Shortcut Description
ctrl-a c create a new window
ctrl-a d detach screen (leaving all programs running)
ctrl-a " display a list of open windows
ctrl-a ctrl-a switch between 2 last opened windows
ctrl-a A set a name for the open window
ctrl-a ESC enters in copy mode - now you can use scroll keys to navigate through the history of the screen (arrows, pgup, pgdn). You'll exit it pressing ESC twice.
ctrl-a n,p Navigate next or previous in the list of open screens
ctrl-a 0-9 jump directly to screen 0..9
ctrl-a S Split the current screen window horizontally
ctrl-a | Split the current screen window vertically
ctrl-a TAB jumps between screen regions
ctrl-a X closes the current region
ctrl-a : enters screen command mode

A very nice feature when using screen is to see (in a pseudo-tabbed manner) the open screens that you have. For this, you can customize your .screenrc file under your profile with something like this:

# Skip the startup message
startup_message off
 
# Display a caption string below, appearing like tabs and
# displaying the window number and application name (by default).
caption always
caption string "%{kw}%-w%{wr}%n %t%{-}%+w"