The disown
command in Bash is used to remove jobs from the shell’s job table, effectively detaching them from the terminal. This allows processes to continue running in the background even after the user has logged out or closed the terminal.
The basic syntax of the disown
command is as follows:
disown [options] [arguments]
-h
: This option prevents the specified job from receiving a SIGHUP signal when the shell exits.-a
: Disown all jobs.-r
: Disown only running jobs.disown %1
-a
option.
disown -a
-r
option.
disown -r
-h
option.
disown -h %1
jobs
command before using disown
to ensure you are disowning the correct job.bg
to send a job to the background before disowning it, if it’s currently running in the foreground.fg
.