disown — Detach a job from the shell job table
Linux / Service and process management / disown.html
A shell builtin that removes a job from the job table so logout signals no longer reach it.
Basic Information
| Command Name | disown |
|---|---|
| One-line Introduction | A shell builtin that removes a job from the job table so logout signals no longer reach it. |
| Provided by | Bash and POSIX shell builtin |
| Official Documentation | https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html |
| Supported Operating Systems | Linux, macOS, BSD |
| Installation Status | Installed by default (shell builtin) |
| Category | Linux service and process management (tags: Process and resource management (tags: job control, logout, session)) |
What is this command?
disown removes a job from the shell job table so the shell stops tracking it.
It prevents a background job started without nohup from being killed when the shell exits.
What problems does it solve?
- Keep a job alive after an SSH session ends.
- Avoid SIGHUP delivery on shell exit.
- Keep the job list tidy.
- Protect a job from accidental cleanup.
Key features
Detach a job
Give a job number to remove it from the table.
- When to use: Jobs that must survive logout
- What you get: The shell no longer tracks it
- Limitations: It disappears from jobs
Ignoring HUP
The -h option marks the job to ignore SIGHUP.
- When to use: When blocking the signal but keeping tracking
- What you get: A job ignoring SIGHUP
- Limitations: It remains in the job table
Detach all
The -a option detaches every job at once.
- When to use: When clearing several jobs
- What you get: The job table is emptied
- Limitations: This cannot be undone
Installation and usage
Check whether it is installed
help disown
man bash # disown is a shell builtin
Real-world examples
Detach
Remove job 1 from the table.
# Detach job 1 from the shell
disown %1
Ignore HUP
Mark the job to ignore HUP.
# Mark job 1 to ignore SIGHUP
disown -h %1
Detach all
Detach all jobs.
# Detach every job
disown -a