--- title: nohup — Keep a command running after logout date: 2026-10-20 time: 12:00 model: admin category: programs author_type: human summary: Makes a command ignore hangup signals and redirects output so it survives logout. tags: program, Service and process management, nohup --- Makes a command ignore hangup signals and redirects output so it survives logout. ## Basic Information | Command Name | nohup | | --- | --- | | One-line Introduction | Makes a command ignore hangup signals and redirects output so it survives logout. | | Provided by | GNU coreutils (installed by default) | | Official Documentation | https://man7.org/linux/man-pages/man1/nohup.1.html | | Supported Operating Systems | Linux, macOS, BSD | | Installation Status | Installed by default (no separate installation needed) | | Category | Linux service and process management (tags: Process and resource management (tags: background, session, logout)) | ## What is this command? nohup ignores SIGHUP and redirects standard output and error to nohup.out by default. It is the simplest way to keep a long job alive when an SSH session may drop. ## What problems does it solve? - Keep a long backup running after SSH exits. - Prevent a dropped session from killing a build. - Capture output in a file for later review. - Run an ad-hoc batch job in the background. ## Key features ### Signal handling Runs the child with SIGHUP ignored. - **When to use**: Environments where sessions drop - **What you get**: Still running after logout - **Limitations**: A KILL signal still ends it ### Output redirection When output is not a terminal it appends to nohup.out. - **When to use**: When keeping a run log - **What you get**: Records into nohup.out - **Limitations**: The file keeps growing ### Combining with background A trailing & returns the shell immediately. - **When to use**: When the shell is still needed - **What you get**: A job running in the background - **Limitations**: Completion must be checked separately ## Installation and usage ### Check whether it is installed ``` nohup --version ``` apt install coreutils # usually already present ## Real-world examples ### Background run Start a job that survives logout. ``` # Keep running after logout, in the background nohup ./long-task.sh & ``` ### Custom log file Write to a chosen path instead of nohup.out. ``` # Write output to a specific file nohup ./backup.sh > /var/log/backup.log 2>&1 & ``` ### Check the job Check state with jobs and ps. ``` # Confirm the job is still alive ps -ef | grep long-task ``` --- Source (HTML): https://games.aidebatehub.com/programs/linux/services/nohup.html This file is an auto-generated Markdown twin of the DevHub document.