Skip to content

Linux nohup Guide

Mattscreative edited this page Dec 5, 2025 · 3 revisions

Linux nohup Guide

Complete beginner-friendly guide to nohup on Linux, covering Arch Linux, CachyOS, and other distributions including running processes in background, preventing hangup, and long-running tasks.


Table of Contents

  1. nohup Basics
  2. Running Commands
  3. Output Redirection
  4. Background Processes
  5. Troubleshooting

nohup Basics

Run Command

Basic usage:

# Run command with nohup
nohup command &

# Continues running after logout

Output File

Default output:

# Output goes to nohup.out
nohup command &

# Creates nohup.out file

Running Commands

Long Running

Persistent process:

# Long running command
nohup ./long-script.sh &

# Continues after terminal closes

Custom Output

Redirect output:

# Custom output file
nohup command > output.log 2>&1 &

# Redirects to output.log

Output Redirection

Standard Output

Redirect stdout:

# Redirect output
nohup command > output.log &

# Saves output to file

Error Output

Include errors:

# Include errors
nohup command > output.log 2>&1 &

# 2>&1 redirects stderr to stdout

Background Processes

Background Execution

Run in background:

# Background with nohup
nohup command &

# & runs in background
# nohup prevents hangup

Check Process

Verify running:

# Check process
ps aux | grep command

# Verify process is running

Troubleshooting

nohup Not Found

Check installation:

# nohup is part of coreutils
# Usually pre-installed

# Check nohup
which nohup

Summary

This guide covered nohup usage, background processes, and long-running tasks for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally