Linux nohup Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
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
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
- jobs Guide - Job control
- bg Guide - Background jobs
- Process Management - Process management
- nohup Documentation:
man nohup
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.