← All languages
$_
Bash command of the day
Random

nohup

Run a command immune to hangups.

Description

The nohup command runs a command that is immune to hangup signals (SIGHUP). When a terminal session is closed, the shell sends SIGHUP to all its child processes, which normally terminates them. nohup prevents this.

By default, nohup redirects standard output and standard error to a file called nohup.out in the current directory (or the home directory if the current directory is not writable). Standard input is redirected from /dev/null.

nohup is commonly used to run long-running processes that should continue after logging out, such as build jobs, data processing scripts, and server processes.

Arguments

NameDescriptionOptional
command The command to run with hangup protection. No
args Arguments to pass to the command. Yes

Example

nohup long_running_script.sh &
nohup ./server --port 8080 > server.log 2>&1 &