disown

Remove jobs from the shell’s job table so they are not sent SIGHUP on logout.

Category: Shell bash jobs process-control background

Install

# disown is a Bash builtin command.
# Available whenever you are using bash.

What it does

disown removes a job from the current shell’s job table. Once disowned, the job will not receive a SIGHUP signal when the shell exits.

How it works (mechanical)

  • Operates on Bash job control table.
  • Targets background or stopped jobs.
  • Prevents SIGHUP delivery on shell exit.
  • Does not change process ownership (PID remains same).
  • Only affects the current shell session.

Quick Start

# Start a background job
sleep 300 &

# Disown the most recent job
disown

10 Practical Examples

# 1) List jobs
jobs
# 2) Disown most recent job
disown
# 3) Disown specific job number
disown %1
# 4) Disown all jobs
disown -a
# 5) Disown only running jobs
disown -r
# 6) Run command in background and disown immediately
longtask &
disown
# 7) Compare with nohup
nohup longtask &
# 8) Check process still running after disown
ps aux | grep longtask
# 9) SSH session example
# Start process remotely, then:
disown
exit
# 10) Bring job to foreground before disowning
fg %1
# Ctrl+Z
bg
disown %1

Notes & Gotchas

  • Works only with Bash job control.
  • Does not redirect output like nohup does.
  • Useful before logging out of SSH sessions.
  • If process depends on terminal I/O, it may still fail.
  • Once disowned, job no longer appears in jobs.

Historical Context

Unix shells have long supported job control. disown was added to allow better control over background processes without needing external tools.

Modern Equivalent

Modern alternatives include nohup, tmux, screen, or systemd user services. However, disown remains a lightweight and fast solution inside Bash.

Related Commands

  • jobs — list shell jobs.
  • bg — resume job in background.
  • fg — bring job to foreground.
  • nohup — run command immune to hangups.
  • kill — send signals to processes.