Keep the running tasks on the remote host continue after turning off the local caller.

Install

sudo apt install screen # ubuntu

Basic command lines

# check screen version
screen -v

# start new session (with name)
screen -S <name>

# list running sessions
screen -ls

# attach to a running session (without name)
screen -x

# attach to a running session (with name)
screen -r <name>

# detach a running session
screen -d <name> # or Ctrl + A, D

Delete detached session

  1. Reattach first: screen -r <name>
  2. Ctrl + A, K then Y

Hotkeys

  • Detach: Ctrl + A, D
  • Reattach: Ctrl + A, R

Reference