Working with ’screen‘

Working with ’screen‘ lets you run multiple „virtual“ windows in Unix. This becomes very interesting on working with a shell and want to quit the shell connection without killing a running shell command (the command already has to be started in a screen).

Get a list of running, named screen sessions
~$: screen -ls

Create a new named screen session
~$: screen -S [screenname]

Reopen a named screen session, if not available, create it
~$: screen -R [screenname]

Reopen a named screen session
~$: screen -r [screenname]

Reopen a named screen session which is already attached wlsewhere
~$: screen -rx [screenname]

Detach a named screen session
~$: screen -d [screenname]

Kill a named screen session remote
~$: screen -X -S [screenname]

Shortcuts within a session:
Ctrl+a c: Open/Create a new window within a screen session
Ctrl+a a: Switch to the last screen window
Ctrl+a d: Detach the screen session [1]
Ctrl+a k: Kill the screen session [2]
Ctrl+a ESC: Scroll screen up/down with the arrow keys (ESC to quit scroll mode)
Ctrl+a „: Get a window overview of the screen session
Ctrl+a 0-9: Switch to window 0-9 of the screen session

1: Detaching a screen will leave the screen (and all its windows) but let it run in the background
2: Killing a session will leave the screen (and all its windows) and close it.