The disown
command is used to remove a job from the job control of the current shell in Unix and Linux systems. When you run a command in the background using the &
operator, it becomes a job that is controlled by the shell. You can use the disown
command to remove a job from the job control of the shell, so that it continues running even after the shell exits.
Here is the basic syntax for using the disown
command:
disown [-h] [-ar] [jobspec ...]
The -h
option tells the shell to mark the job as "no hangup", which means that the job will not receive a SIGHUP
signal when the terminal disconnects. The -a
option tells the shell to operate on all jobs, and the -r
option tells the shell to operate only on running jobs. The jobspec
argument specifies the job or jobs that you want to disown.
Here are some examples of using the disown
command:
For example, to disown the job with job number 1, you can use the following command:
disown %1
To disown the job with the name myjob
, you can use the following command:
disown %myjob
-a
option.For example:
disown -a
This will disown all jobs in the current shell.
-r
option.For example:
disown -r
This will disown all running jobs in the current shell.