Skip to content

nohup command

Keep a command running after you log out.

On this page

Syntax

nohup command [args] &

Provided by the coreutils package. Run man nohup for the full manual.

Common options

OptionWhat it does
&Run in the background
> FILE 2>&1Send output to a file
jobsList background jobs
fg / bgBring to the foreground / continue in background
disownDetach a running job from the shell

Examples

  1. Run a script that survives logout

    nohup ./long-task.sh &
  2. Choose the log file

    nohup ./server.sh > server.log 2>&1 &
  3. Detach a job you already started (Ctrl+Z, then)

    bg && disown
  4. List background jobs

    jobs -l

nohup guides

← All Linux commands · Suggest a fix

Back to top