Skip to main content

Screen

Start a screen

screen -S <name> <command>

Pass -dm to start in detached mode.

Stuff text into a session

The ^M will be replaced with a newline.

screen -S <name> -p 0 -X stuff "some command^M"

Attach and detach

Attach to a session

screen -r <name>

Detach with a shortcut

Press Ctrl + A, then D

Detach from outside

screen -dmS <name>