The “disown” command in Linux is used to remove a running or backgrounded job from the shell’s control. This means that the job will continue to run even after the user logs out of the system or closes the terminal window.
The basic syntax of the command is:
# disown [-h] [-ar] [jobspec ...]
-h: causes the job to be not listed by the jobs command.
-a: causes all jobs to be disowned.
-r: causes all running jobs to be disowned.
jobspec: specifies the job to be disowned. If no job specification is provided, the current job is used.
For example, to disown the current background job the command would be “disown %1011” where 1011 is the job number.
disown Command Examples
1. Disown the current job:
2. Disown a specific job:
# disown %job_number
3. Disown all jobs:
# disown -a
4. Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit:
# disown -h %job_number