man.lsPlain-English help for Unix commands

nohup Run a command that survives logout

Starts a command and makes it ignore the hang-up signal, which a shell sends to its jobs when the terminal closes. You reach for it to leave a long job running after you close the window or disconnect from a remote machine.

Synopsis

nohup COMMAND [ARGUMENT]...
nohup COMMAND [ARGUMENT]... > FILE 2>&1 &

Common options

Option or formWhat it does
COMMANDThe program to run. nohup has no options of its own on macOS besides the optional -- before the command
> FILEShell redirection that sends the program's output to FILE instead of nohup.out
2>&1Shell redirection that sends error messages to the same place as normal output
&Shell feature that runs the command in the background so you get your prompt back
< /dev/nullOptional shell redirection that stops the program waiting for input from the terminal

Examples

Run a command with its output saved to a file
nohup echo hello > out.log 2>&1
Run a long script in the background and keep it after logout
nohup ./long-job.sh > job.log 2>&1 &
Same, with no terminal input
nohup ./long-job.sh > job.log 2>&1 < /dev/null &
Run without redirecting, so output goes to nohup.out
nohup ./long-job.sh &
Find the process again later
ps aux | grep '[l]ong-job'

Notes

See also

Last reviewed 2026-10-07.