nohup
process managementLinux/Unix
The nohup command is one of the most frequently used commands in Linux/Unix-like operating systems. nohup Run a command immune to hangups, with output to a non-tty
Quick Reference
Command Name:
nohup
Category:
process management
Platform:
Linux/Unix
Basic Usage:
nohup [options] [arguments]
Common Use Cases
Syntax
nohup COMMAND [ARG]...
Options
Option | Description |
---|---|
--help |
Display help information and exit |
--version |
Output version information and exit |
Common Output Redirection with nohup:
Syntax | Description |
---|---|
nohup command > output.log |
Redirect stdout to output.log (stderr still goes to nohup.out) |
nohup command > output.log 2>&1 |
Redirect both stdout and stderr to output.log |
nohup command > /dev/null 2>&1 |
Discard all output (both stdout and stderr) |
nohup command > output.log 2> error.log |
Redirect stdout to output.log and stderr to error.log |
Examples
How to Use These Examples
The examples below show common ways to use the nohup
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
nohup ls -la