Nohup
nohup is a POSIX command which means "no hang up".[src] Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out.[src] Output that would normally go to the terminal goes to a file called , if it has not already been redirected.[src]
nohup is a POSIX command which means "no hang up".[src] Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out.[src] Output that would normally go to the terminal goes to a file called , if it has not already been redirected.[src] $ nohup abcd & $ exit Note that these methods prevent the process from being sent a 'stop' signal on logout, but if input/output is being received for these standard I/O files (stdin, stdout, or stderr), they will still hang the terminal.[src] See Overcoming hanging, below.[src] nohup is often used in combination with the nice command to run processes on a lower priority.[src] $ nohup nice abcd & $ exit ==Implementations== Some shells (e.g.[src] bash) provide a shell builtin that may be used to prevent SIGHUP being sent or propagated to existing jobs, even if they were not started with nohup.[src] In bash, this can be obtained by using disown -h job ; using the same builtin without arguments removes the job from the job table, which also implies that the job will not receive the signal.[src] Before using disown on an active job, it should be stopped by Ctrl-Z , and continued in the background by the bg command.[src] Another relevant bash option is shopt huponexit , which automatically sends the HUP signal to jobs when the shell is exiting normally.[src] The AIX and Solaris versions of nohup have a -p option that modifies a running process to ignore future SIGHUP signals.[src] Unlike the above-described disown builtin of bash, nohup -p accepts process IDs.[src] The command has also been ported to the IBM i operating system.[src] ==Overcoming hanging== Note that nohupping backgrounded jobs is typically used to avoid terminating them when logging off from a remote SSH session.[src] A different issue that often arises in this situation is that ssh is refusing to log off ("hangs"), since it refuses to lose any data from/to the background job(s).[src] This problem can also be overcome by redirecting all three I/O streams: $ nohup ./myprogram > foo.out 2> foo.err Also note that a closing SSH session does not always send a HUP signal to dependent processes, such as when a pseudo-terminal has not been allocated.[src] ==Alternatives== A terminal multiplexer can run a command in a separate session, detached from the current terminal, which means that if the current session ends, the detached session and its associated processes keeps running.[src] One can then reattach to the session later on.[src] For example, the following invocation of screen will run somescript.sh in the background of a detached session: $ screen -A -m -d -S somename ./somescript.sh & The disown shell builtin is used in some shells to remove jobs from the job table, or to mark jobs so that a SIGHUP signal is not sent on session termination.[src] ==References== ==External links== nohup from Solaris's man pages[src]
24 sentences · 24 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Nohup." encyclopegia.org, 2026, https://encyclopegia.org/wiki/nohup. Accessed 05 December 2026.
Chicago
"Nohup." encyclopegia.org. Accessed December 5, 2026. https://encyclopegia.org/wiki/nohup.
APA
encyclopegia.org. (2026). Nohup. Retrieved December 5, 2026, from https://encyclopegia.org/wiki/nohup
Accessed December 5, 2026 · CC BY-SA 4.0 · citation page · JSON