Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
User Commands (m - o) nohup(1)
NAME
nohup - Runs a utility ignoring hangups
SYNOPSIS
nohup utility [argument ...]
DESCRIPTION
The nohup command runs utility with arguments supplied as argument values, ignoring all hangup
signals. You can use this command to run programs in the background after logging out of the sys-
tem. To run a nohup command in the background, add an & (ampersand) to the end of the com-
mand. When utility is invoked, the SIGHUP signal is ignored.
If nohup output is redirected to a terminal or is not redirected at all, the output is appended to the
file nohup.out. If the file is created, the permission bits are set to S_IRUSR and S_IWUSR.If
nohup.out is not writable in the current directory, the output is redirected to $HOME/nohup.out.
If neither file can be created or opened for appending, utility is not invoked.
The nohup command accepts just one utility as an argument. To apply nohup to a pipeline or list
of commands, enter the pipeline or list in a shell script file. Then run sh as utility using the follow-
ing format:
nohup sh -c file
You can also assign the shell file execute permission and run it as the utility in the form:
nohup file
EXAMPLES
1. To leave a command running after logging out (sh only), enter:
nohup find / -print &
Shortly after you enter this, the following is displayed:
670
$ Sending output to nohup.out
670 is the process ID of the command you just put in the background. The $ (dollar sign)
is the shell prompt.
The following is a message informing you that the output from the find command is in the
file nohup.out.
Sending output...
You can log out after you see these messages, even if the find command has not finished
yet.
2. To do the same, but redirect the standard output to a different file, enter:
nohup find / -print >filenames &
This runs the find command and stores its output in a file named filenames. Now only the
process ID and prompt are displayed.
Wait for a second or two before logging out, because the nohup command takes a moment
to start the utility you specified. If you log out too quickly, utility may not run at all. Once
utility has started, logging out will not affect it.
527188-003 Hewlett-Packard Company 6−87