Intermediate Package: coreutils

nohup

Run a command immune to hangups, so it keeps running after logout.

Syntax

nohup command [args] &

Description

nohup prevents a process from receiving the SIGHUP signal that is normally sent when the controlling terminal closes, which is essential for long-running commands started over SSH sessions that may disconnect.

Examples

nohup ./long-script.sh &
Run a script in the background, immune to terminal disconnects
nohup python3 worker.py > worker.log 2>&1 &
Background a process and redirect its output to a log file
For anything beyond a quick one-off, a systemd service or tmux/screen session is usually more robust.

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux