Background Shell
til
A command started in a shell is tied to that shell. Closing the shell can stop the command, even if it is running in the background.
# will exit when the shell is closed
$ sleep 100 &
[1] 12345Use nohup to keep a background command running after you close the shell.
$ nohup sleep 100 &
[1] 12345This is useful for jobs that take a while, such as model training. If you already started the command without it, suspend the command, resume it in the background, and remove it from the shell's job list:
$ sleep 100
^Z
shell: suspended sleep 100
$ bg
[1] + continued sleep 100
$ disown %1