]> sipb.mit.edu Git - wiki.git/blob - doc/screen.mdwn
explain the "C-a C-a" notation.
[wiki.git] / doc / screen.mdwn
1 [[!meta title="Using Screen"]]
2
3 ## Why?
4
5 `screen` is a handy tool.  It lets you get more out of a terminal
6 session, whether in a window, via ssh, or by some more esoteric means.
7 Its original reason for existence was allowing you to switch between
8 subsessions on a [video-display
9 terminal](http://en.wikipedia.org/wiki/Video_terminal), but it grew to
10 allow sessions that could be detached and reattached (if you went home
11 for the day, or say you were connecting via a glitchy network) and
12 eventually to allow the same session to be simultaneously accessed
13 from multiple places.
14
15 ## Getting Started
16
17  1.  Pick a machine to run your screen session on.  If you don't know of any options, linux.mit.edu (Linerva) is a good choice.
18  2.  ssh to that machine.
19  3.  run `screen`
20  4.  Do stuff.
21
22 To detach, type "C-a d" (That's control+a, release both keys, press 'd'.) .  To reattach, type `screen -dr`.
23
24 If you close your ssh connection without detaching, or lose your
25 network connection:
26
27  1.  run `screen -dr`
28  2.  Do stuff.
29
30 The `-dr` means "find my screen session, detach it from wherever it's
31 attached if it's attached, and reattach it here."
32
33 Once you're comfortable with this, hit "C-a C-c".  This creates what
34 screen calls a new "window"; it should give you a new shell prompt,
35 and you can do stuff at it.  If you want to switch back to the old
36 "window", hit "C-a C-a".  You can create as many "windows" as you
37 want; you can switch to the first 10 of them with "C-a 0" through "C-a
38 9" and see a list of what's open with "C-a w".  ("C-a C-a" actually
39 means "switch to the previously used window".)
40
41 A useful shorthand: `screen -dR` is like `screen -dr` except
42 it adds a "if I don't already have a session, create one" step.
43
44 You can use `screen -x` to attach a screen session that's already
45 attached somewhere without detaching it first.  This can have side
46 effects if the other place is already attached or is in a window that
47 is a different size than your current one.  It's useful when you want
48 to share context between different screens, or even different people,
49 but doing it when you're not sure where else your screen might be
50 attached has privacy implications.
51
52 ## For More Information
53
54 `screen` can do lots of stuff.  If you have a while to burn, run
55 `man screen` at the shell prompt.  It may be helpful to do this
56 inside of `screen` so you can put it down and come back to it later.
57
58 ## TODO
59
60 clean up, explain the "C-a C-a" notation.