Home·Terminal commands

nohup

Processes and system

Usage

nohup <command> [args] &

Makes a command ignore the hangup signal so it survives logout; it does not background anything, so you still add `&` yourself, and output piles up quietly in ./nohup.out.

Common flags

FlagMeaning
&You add this yourself: nohup alone does not put the command in the background.
> out.log 2>&1Send output somewhere other than the default ./nohup.out.
< /dev/nullDetach stdin as well, so the command cannot stall waiting for input.

Examples

nohup ./server.sh > server.log 2>&1 &

Start the server so it survives logout, with its own log file.

nohup make -j4 &

Run a long build that keeps going after you disconnect; output lands in nohup.out.

What is running and what is eating the machine. Identifying it comes before killing it.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does nohup do?

Makes a command ignore the hangup signal so it survives logout; it does not background anything, so you still add `&` yourself, and output piles up quietly in ./nohup.out.

Q. How do I type it?

nohup <command> [args] & — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

3 are listed here; the full set is in man nohup. This command sits under Processes and system.

Related commands

man page: man nohup