There's a wealth of stack exchange answers regarding nohup, here's a couple for reference:
When do you need 'nohup' if you're already forking using '&'?
Why use "nohup &" rather than "exec &"
The canonical answer seems to be that using nohup prevents the process from ending when the terminal is closed, so commands like this:
nohup mycommand >& mycommand_output.txt &
will still be running the next time I log in, and it saves the output so I can check it later.
But if I save a few keystrokes:
mycommand >& mycommand_output.txt &
is also still running when I next log in.
It's different from nohup since I can stop it with a kill -HUP
. When I log back in, ps -x
says the processes's TTY is now ?
, so the process isn't still connected to a terminal.
Why doesn't the process stop when I exit the shell?
Can I safely assume my processes won't end if I don't use nohup?
In case it matters, my current environment involves SSHing into a Debian machine from an Ubuntu machine.