nohup - run a command immune to hangups, with output to a non-tty
nohup COMMAND [ARG]...
Options you will use
--help- display this help and exit
--version- output version information and exit
Examples
$ nohup ./long-job.sh &keep running after the terminal hangs up; output goes to ./nohup.out
$ nohup ./long-job.sh > job.log 2>&1 &choose where the output goes instead of nohup.out
Gotchas
- If standard input is a terminal, redirect it from an unreadable file. If standard output is a terminal, append output to 'nohup.out' if possible, '$HOME/nohup.out' otherwise. If standard error is a terminal, redirect it to standard output.
- nohup only makes the command ignore SIGHUP. It does not put it in its own session, and SIGTERM or SIGKILL still end it. For anything that matters, run it as a unit: systemd-run --unit=NAME COMMAND.
Taught in
Try nohup in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.