LinuxCommandLibrary

nohup

Run command, ignoring hangup signals

TLDR

Run a process that can live beyond the terminal

$ nohup [command] [argument1 argument2 ...]
copy

Launch nohup in background mode
$ nohup [command] [argument1 argument2 ...] &
copy

Run a shell script that can live beyond the terminal
$ nohup [path/to/script.sh] &
copy

Run a process and write the output to a specific file
$ nohup [command] [argument1 argument2 ...] > [path/to/output_file] &
copy

SYNOPSIS

nohup COMMAND [args]

DESCRIPTION

nohup runs a command that continues running after the terminal is closed. It redirects output to nohup.out and makes the process immune to SIGHUP signals. nohup is useful for starting long-running processes that should persist after logout.

CAVEATS

Output goes to nohup.out by default. Process still receives other signals. Consider using screen/tmux for interactive processes. Use & for background.

SEE ALSO

disown(1), screen(1), tmux(1), bg(1)

Copied to clipboard