Screen package in Linux will create new terminal from current terminal and keep the connection without disconnect automatically.
sudo apt-get update
sudo apt-get install screen
screen -S name -d -m -L
-S name: Specifies the session name as "name".
-d -m: Starts the screen session in detached mode.
-L: Enables logging.
So, this command creates a new screen session named "name," starts it in detached mode, and enables logging.
# Reattach
screen -r name
# Detach - Just exit current terminal screen - NOT close
# ctrl-a + ctrl-d
# control-a + control-d (d=detach)
exit
# or: control-a + control-k (k=kill)
Written with StackEdit.