Screen is one way to keep a process running even after closing SSH connection. Like most things in Linux there are more ways to keep a process running even after closing SSH connection:
“Ctrl+a” immediately followed by “d” and you will be back to the terminal seeing the message that the Screen is detached. Now you can safely logout and your session will be left alive.
Tmux is another piece of software which is created to be a replacement for screen. It has most of the capabilities of screen, with few additional capabilities which make it more powerful than screen.
$ tmux detach
$ tmux attach
Executing command using nohup in background
Disown, removes the job from the process job list of the system, so the process is shielded from being killed during session disconnection as it won’t receive SIGHUP by the shell when you logout.
You can also use execute any command using setsid.
setsid allocates a new process group to the process being executed and hence, the process created is a newly allocated process group and can execute safely without fear of being killed even after session logout.🐧👍
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.