Some basic info on screen:

The escape character is ^A (by default). This means that, instead of typing ^A to jump to the beginning of a line in anything with Emacs-style keybindings, you must type ^A-a. (Note, screen is case-sensitive on the keystroke following ^A).

To open a new terminal, type ^A-c.
To flip back to your most recent window, type ^A-^A. After you flip to this, ^A-^A will jump back to where you just were. A similar behavior is ^A-^H, which will jump back farther and farther in your window history, without changing the ordering of the history (unless you were to execute another window-changing command); to move back up in the window history, use ^A-<SPACE>.
If you need a quick overview of commands, ^A-?.
You can move around among different windows with ^A-n and ^A-p. Another handy feature is to set window titles; do this with ^A-A. Then, use ^A-" to choose a window from a list, or, ^A-' to let you type in the name of a window (or at least the first few characters) to jump to it. ^A-0 through ^A-9 will jump through the first ten windows. You can get a list with ^A-w (in an xterm, this displays in the titlebar).
The most useful feature of screen, perhaps, is the ability to idle on your favorite IRC channel 24/7/365. screen sessions can be detached with ^A-d. To resume, type screen -r. If there are multiple sessions available, you can type screen -list to get a list, and then screen -r specifier to get to a particular session. screen -R will also start a recent session, or, if none is available, will open a new one. If you accidentally left a session attached somewhere else, screen -d will detach it (screen -d -r will detach and then subsequently resume it on the current connection).
To lock a terminal quickly, type ^A-x.
Monitoring log windows is done with ^A-M. Then, screen will alert you whenever there is activity in that window, regardless of what window you are currently viewing.
To split the window, type ^A-S. You can jump between the two with ^A-<TAB>. To hide the current mini-window, press ^A-X. To hide all but the current mini-window, press ^A-Q.
~/.screenrc can contain windows that you might always want to start. Just add a line to the file of the form "screen command". Other useful lines to put in that file are "startup_message off" and "screen -t title", which will set the default title for new windows.
If a window dies, chances are you've probably pressed XON (^S, ^A-s, or ^A-^S); try ^A-^Q, ^A-q, and ^Q. If you must kill a window, type ^A-K.
screen emulates as many ANSI/VT100/VT102 functions as it can with your current term-type. Internally, spawned shells will have the 'screen' type. If you connect to a system that doesn't have screen installed, you'll get "Terminal type 'screen' is unknown" messages. You can put something like this in your ~/.bash_profile on those machines to remedy this:

if [ "$TERM" = "screen" ] ; then export TERM=vt100 ; fi

If you're using an older machine without bash/tcsh/zsh, you may find the command-history feature useful. ^A-{ will recall the previously typed command (much like M-p in emacs); ^A-} moves back down in the command history (like M-n in emacs). Another useful features for using older terminals or terminal software is entering digraphs, done with ^A-^V-(digraph)-enter.
screen also has copy+paste features. To copy text, press ^A-[, move the cursor to the upper-left corner of the region to copy, press enter, then move the cursor to the lower-right corner and press enter; screen will copy the intermediate lines. To save this to a file in /tmp, use ^A->. To read this file back into the copybuffer, use ^A-<. To clear the buffer, ^A-=. Pasting is done with ^A-].
Output logging can be enabled/disabled with ^A-H.
screen will output the current time and load average with ^A-t.
If you miss the last message screen has displayed, press ^A-m.
To input a screen command by text (rather than by keystroke), press ^A-: and then type the command press enter.
The screen can be refreshed with ^A-l (that's a lowercase ell), and cleared with ^A-C.

New as of Mar 12, 2006: a trick for using multiple terminals on one screen session simultaneously.

New as of Jul 10, 2007: another tutorial that looks pretty good
twin, a similar idea but more GUI-sh

[ Back ]