TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
disown command is a Bash shell builtin that removes a specified job from the shell’s internal job control table. By removing the job from this table, the shell relinquishes tracking of the process, ensuring the shell will not broadcast a SIGHUP (Hangup) signal to that process if the shell receives a SIGHUP or terminates under specific configurations.
Technical Mechanics
When a process is executed in the background (e.g., appended with& or suspended and resumed via bg), Bash assigns it a job specification (jobspec) and tracks it in an internal array. Bash broadcasts a SIGHUP to all tracked child processes in this array under two specific conditions:
- The shell itself receives a
SIGHUP(such as when the controlling terminal emulator is closed). - The shell is an interactive login shell terminating normally, and the
huponexitshell option is enabled.
disown alters this state in one of two ways, depending on the flags provided: it either completely excises the process from the job table, or it modifies the job’s internal flags to bypass the SIGHUP broadcast while maintaining its presence in the table.
Parameters and Flags
jobspec: The job identifier (e.g.,%1,%2). If omitted,disowndefaults to the current job (represented by%+or%%).-h: Retains the job in the job control table but sets a flag preventing the shell from sendingSIGHUPto it. The job remains visible to thejobscommand.-a: Applies thedisownoperation to all jobs currently in the job table.-r: Restricts the operation to running jobs only, ignoring any jobs that are currently stopped (suspended).
State Transition Example
I/O Stream Behavior
disown operates strictly on signal propagation and job tracking; it does not detach the process from the controlling terminal’s file descriptors.
If a disowned process attempts to read from stdin or write to stdout/stderr after the controlling terminal is destroyed, the process will encounter an I/O error (typically resulting in a SIGPIPE or immediate termination). Furthermore, closing the terminal emulator itself may cause the terminal line discipline to send a SIGHUP directly to the session leader and its foreground process group, independent of the shell’s job control mechanisms.
Master Bash with Deep Grasping Methodology!Learn More





