GNU Screen is a terminal application for running persistent, multiple sessions inside a single terminal (or in the most useful case, a ssh connection)
Running Screen:
apt-get install screen: installs screen on Debian
screen: starts a new screen session
screen -r: reattaches to an existing screen session
screen -x: reattaches to an existing screen session where the original session is still attached (happens when screen has not been properly detached)
Ctrl-a d: detaches from a running screen session (note this will lose split screen placement -
this is the only way I've found to avoid that)
Creating and switching between terminal sessions:
Ctrl-a c: Create new terminal session
Ctrl-a n: Switch to next running terminal session (also
Ctrl-a space) Ctrl-a p: Switch to previous running terminal session
exit: This will close the running terminal session, as usual.
Split Screen:
Ctrl-a |: Split screen vertically (note this one isn't in all screen versions - it is in the Debian one however)
Ctrl-a S: Split screen horizontally
Ctrl-a Tab: Switch to the next screen
Ctrl-a X: Remove active bit of split screen (opposite from | and S)
Copy and Paste:
Screen supports copy and paste between terminal sessions. Copying from a vertically split screen from an ssh session (as in to a different application on your client operating system) can be tricky if it extends over multiple lines, as you'll get the stuff from the other terminal too -
Perry Nguyen has a solution for this, although I've yet to try it.
Ctrl-a [: Starts copy mode. Press enter/space to start, enter/space again to end.
Ctrl-a ]: Paste
Ctrl-a <: Copy from a file
Ctrl-a >: Paste to a file
Other:
Ctrl-a ?: Command reference (also see the
manual)
Copy mode can also be used to view the scrollback buffer: after
Ctrl-a [ you can use the arrow keys to scroll up to its limits -
Esc exits without copying.