Operations 2 min read

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.

Open Source Linux
Open Source Linux
Open Source Linux
How to Run Programs Continuously with nohup on Linux

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>&1
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxsystem operationsnohupbackground process
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.