You should use screen if:

Using screen in a terminal

  • you ever work remotely on unix machines.
  • you work remotely, sometimes get disconnected, and hate losing your work.
  • you get tired of having to close emacs/vi/whatever, compile/test your program, and then re-open your editor and find your place in the code again. With screen, you can have a "compile/test" window, and an "edit" window, just like if you were using a real window manager

Screen gives you these features:

  • ability to reconnect when disconnected from a server, without losing any work
  • saving of your state, so you can disconnect, go to another computer, and reconnect, without closing whatever you were working on
  • ability to have multiple windows within one terminal window (not all that useful, but saves you from having to re-ssh every time)

Using screen:

To launch screen: type screen -RR . This will create a new screen if there isn't one already, and it will reconnect to a previous screen if you already had a screen running on this machine. If you forget the "-RR," you always get a new screen.

Now that you're running screen, you don't have to worry about your internet connection going out and your current job being lost. Screen will still be running when you reconnect to the remote machine, and it will be exactly as it was when you got disconnected.

Control-a means "Screen! listen to this next character!" Note that this means if you are used to the emacs-style "ctrl-a means go to the beginning of line," now you have to type "=ctrl-a= and then plain a again" to get the same behavior. Slightly annoying, but you do get a lot of other features. All screen commands are preceded by ctrl-a.

Ctrl-a, then ctrl-a again: switch to the last window (switch between windows). This is like "alt tab"--by default, it just switches you to the last thing you were doing.

Ctrl-a, then " (double-quotes, or rather, shift+single-quote-key): Show a list of active windows. Then you can select them by navigating with the arrow keys and hitting enter.

Ctrl-a, then a number from 0 through 9: switch directly to screen #N (this is like a quick way that bypasses ctrl-a + ").

Ctrl-a, then K (upper-case K!). Kill (close) a screen window (this is the equivalent of closing a terminal window, if you weren't using screen).

Ctrl-a, then ?: list the options for screen. Not very helpful, but good if you want a quick summary of all the screen options.

Beware: ctrl-a + x locks the screen. Then you'll have to disconnect and reconnect, as it seems that your password never ever actually works.