$ screen
create new screen: ctrl+a c
Note: the screen number will be the next available index. If the current set of windows is [0 1 2 5 7 8 9], then the next window created will be 3
move a window in the indexed order: ctrl+a :number x
Note: type ":number" literally
"x" is the desired index
If destination index is currently occupied, then the two windows are switched in index order. For example, if the current set of windows is [0 1 2 3 4 5] and I am in 4, if I try to 4 into 1, I will end up with [0 4 2 3 1 5]
switch current and previous window: ctrl+a ctrl+a
cycle through existing windows: ctrl+a ctrl+n
cycle backwards through existing windows: ctrl+a ctrl+p
show number and title of existing window: ctrl+a N
switch to named window (or 0 through n): ctrl+a '
display list of screens to jump to: ctrl+a "
Flags:
@ when monitoring activity, there has been activity in this window
! lost remote connection
allow user to set name ctrl+a A
kill window : ctrl+a k
Note: original numbering scheme is retained if a window is killed out of order. If the current set of windows is [0 1 2 3 4 5] and 3 is killed, then [0 1 2 4 5] is the new set
enable scroll back: ctrl+a ]
then Enter to start copy, Enter to finish copying
paste copied text: ctrl+a [
monitor window for activity: ctrl+a M
detach: ctrl+a d
After detaching one should list available sessions to reconnect to
$ screen -ls
then if only one session is listed, you'll want to reattach to the previous session
$ screen -r
or reconnect to one of the listed sessions
$ screen -r <session name>
Note: If you're having trouble, make sure CAP LOCKS is off, and num lock is on.
Remote sessions:
Option 1: SSH to remote box, then establish screen session
Option 2: establish screen session, then SSH to remote box
If the local computer crashes, then option 1 allows you to reconnect to the remote screen session. If you were using option 2, you lose the local screen session and the remote SSH connection.
If the remote computer crashes, in option 1 results in loss of remote session and the SSH connection closes. If option 2 was in use, then SSH connection is lost and screen session is no longer available.
Thus, option 1 is preferable.
http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/
http://www.soulcast.com/post/show/55079/An-introduction-to-the-linux-screen-command