nohup - disown
March 10, 2018
In case you don't have screen/tmux and need to run a process that won't be terminated after closing the terminal:
$ nohup your command &
$ exit
Or
$ your command &
$ disown
$ exit
If you have multiple commands:
$ sleep 3600 &
$ sleep 86400 &
By typing jobs
something like this appears:
[1] - running sleep 3600
[2] + running sleep 86400
To disown
let's say only job 2:
$ disown %2
🔗process already running
You can pause it ctrl+z
, something like this will appear:
$ sleep 3600
^Z
zsh: suspended sleep 3600
Then type bg
to put it in background:
$ bg
[1] + continued sleep 3600
After that you can disown and exit:
$ disown
$ exit