Processes
disown
Remove shell jobs from the current shell's job table.
shelljobsbackgroundlogoutlong-running
Additional Notes
disown removes one or more background jobs from the current shell's job table so they are not sent a SIGHUP when the shell exits. It lets a long-running job keep going after you log out, much like nohup but applied later.
Jobs are referenced by number (such as %1) or by name. Run jobs first to see the current list.
Syntax
disown [options] [job ...]
Parameters
options: Flags that choose which jobs or what happens on logout.job: Job spec such as%1,%2, or%name; omit to use the current job.
Common Options
-a,--all: Act on all jobs.-r,--running: Act only on running jobs.-h: Mark jobs so they keep getting SIGHUP on logout (but stay in the table).-rwith no-h: Default behavior removes the jobs from the table.
Examples
sleep 600 &
disown
jobs
Start a background job, remove it from the table, and confirm it is gone.
long-task.sh &
disown %1
exit
Let long-task.sh survive shell logout.
disown -a
Remove every job from the table at once.
disown -a -h
Keep all jobs in the table but stop SIGHUP from killing them on exit.
make &
disown -h %1
Mark the make job to ignore hangup signals.
Practical Notes
- Use
jobsto list job numbers beforedisown. disownwithout-hremoves the job; with-hit stays listed but ignores SIGHUP.- For jobs you start knowingly,
nohup command &is often simpler thandisown. - A disowned job is still a child until it exits; closing the terminal no longer kills it via hangup.
- Prefer
screenortmuxwhen you also want to reattach and watch the job later.