How to Run Programs Continuously with nohup on Linux
This guide explains how the nohup command lets you run Linux programs without hanging up, redirects output to nohup.out or a specified file, and provides common options and practical examples for background execution and output redirection.
nohup: Run Programs in Background
Function Description
nohup (short for “no hang up”) runs a program while ignoring hang‑up signals, so its output is not shown on the terminal.
Using nohup allows a command to continue after logging out, closing the terminal, or disconnecting. Output is appended to nohup.out in the current directory, or to $HOME if the file is not writable. If neither can be created, the command fails. When stderr is a terminal, it is redirected to the same file descriptor as stdout.
Command Syntax
nohup [options]Common Options
--help : display online help
--version : show version information
Example Usage
Example 1
Run a script in the background with nohup:
# nohup bash cnLinuxer.sh &Example 2
Redirect output to a specific file:
# nohup command > linuxyz.cn 2>&1Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
