> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash Disown Job

The `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.

```bash theme={"dark"}
disown [-ar] [-h] [jobspec ...]
```

## 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:

1. The shell itself receives a `SIGHUP` (such as when the controlling terminal emulator is closed).
2. The shell is an interactive login shell terminating normally, and the `huponexit` shell option is enabled.

Executing `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, `disown` defaults to the current job (represented by `%+` or `%%`).
* **`-h`**: Retains the job in the job control table but sets a flag preventing the shell from sending `SIGHUP` to it. The job remains visible to the `jobs` command.
* **`-a`**: Applies the `disown` operation 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

```bash theme={"dark"}

# 1. Process is spawned in the background
sleep 300 &

# Output: [1] 14592


# 2. Process is tracked in the job table
jobs

# Output: [1]+  Running                 sleep 300 &


# 3. Process is excised from the job table
disown %1


# 4. Job table is now empty; shell will not send SIGHUP to PID 14592
jobs

# Output: (empty)
```

## 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.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Bash Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
