Let's say I launch a bunch of processes from a ssh session. Is it possible to terminate the ssh session while keeping those processes running on the remote machine?
Ubuntu – How to keep processes running after ending ssh session
ssh
ssh
Let's say I launch a bunch of processes from a ssh session. Is it possible to terminate the ssh session while keeping those processes running on the remote machine?
Best Answer
You should look for modern alternatives like
tmux
.tmux
is superior toscreen
for many reasons, here are just some examples:Basic Functionality
To get the same functionality as explained in the answer recommending
screen
, you would need to do the following:tmux
by typingtmux
into the shelltmux
sessiontmux
session by typing Ctrl+b and then dYou can now safely log off from the remote machine, your process will keep running inside
tmux
. When you come back again and want to check the status of your process you can usetmux attach
to attach to yourtmux
session.If you want to have multiple sessions running side-by-side, you should name each session using Ctrl+b and
$
. You can get a list of the currently running sessions usingtmux list-sessions
, now attach to a running session with commandtmux attach-session -t <session-name>
.tmux
can do much more advanced things than handle a single window in a single session. For more information have a look inman tmux
or the tmux GitHub page. In particular, here's an FAQ about the main differences betweenscreen
andtmux
.