nohup — Start a process that is immune to hang ups

Format

nohup command-line

tcsh shell: nohup command

Description

nohup invokes a utility program using the given command-line. The utility runs normally; however, it ignores the SIGHUP signal.

If the standard output is a terminal, nohup appends the utility's output to a file named nohup.out in the working directory. This file is created if it does not already exist; if it cannot be created in the working directory, it is created in your home directory.

If the standard error stream is a terminal, nohup redirects the utility's error output to the same file as the standard output.

nohup simply runs a program from an executable file. command-line cannot contain such special shell constructs as compound commands or pipelines; however, you can use nohup to invoke a version of the shell to run such a command line, as in:
nohup sh –c 'command*'
where command can contain such constructs.

In the tcsh shell, with command, nohup runs command such that it will ignore hang up signals. Commands can set their own response to hang ups, overriding nohup. Without an argument (allowed only in a shell script), nohup causes the tcsh shell to ignore hang ups for the remainder of the script. See tcsh — Invoke a C shell.

Localization

nohup uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

126
nohup found the utility program but could not invoke it.
127
An error occurred before nohup invoked the utility, or nohup could not find the utility program.

Otherwise, the exit status is the exit status of the utility program that is invoked.

Portability

POSIX.2, X/Open Portability Guide, UNIX Systems

Related information

exec, hup, nice, sh, tcsh