johnslattery
8/22/2016 - 5:14 PM

Disconnect process from terminal. Following a command with '$' will put the process in the background as will '^z, bg'. The process will sti

Disconnect process from terminal. Following a command with '$' will put the process in the background as will '^z, bg'. The process will still receive SIGHUP from the terminal when closed. 'nohup' before the command will start the process not listening for SIGHUP, but the process may subsequently change that behavior, itself. Additionally, nohup redirects stdout and stderr to file nohup.out in the current directory or, if that fails, home directory. Following '$' with 'disown' will remove the process from the job list, preventing the job form getting a SIGHUP even if it's listening for one. nohup is specified in the POSIX standard while disown is peculiar to shells such as bash and zsh. (https://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and) Note that in bash '$' and ';' are both command terminators meaning respectively, bg and fg, so '$;' implies an empty command which isn't allowed in bash. 'cmd $; disown' doesn't work.

# If you don't care about being POSIX compliant or stdout and stderr:
cmd >/dev/null 2>&1 & disown