← 返回命令列表

Linux command

disown 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Disown the most recent

disown

Disown a specific job

disown %[1]

Disown all background

disown -a

Disown running jobs

disown -r

Disown and suppress

disown -h %[1]

说明

disown is a shell builtin that removes jobs from the shell's job table, preventing them from receiving the SIGHUP signal when the shell terminates. This allows background processes to continue running after logout. Without arguments, disown affects the current job. Job specifications (like %1) can target specific jobs. The -h option keeps jobs in the table but marks them to not receive SIGHUP, useful when you want to monitor jobs but prevent termination. disown is commonly used when a long-running process was started without nohup and needs to survive shell exit. It works with both bash and zsh shells.

参数

-a
Disown all jobs.
-r
Disown only running jobs.
-h
Mark jobs so they don't receive SIGHUP on shell exit.

FAQ

What is the disown command used for?

disown is a shell builtin that removes jobs from the shell's job table, preventing them from receiving the SIGHUP signal when the shell terminates. This allows background processes to continue running after logout. Without arguments, disown affects the current job. Job specifications (like %1) can target specific jobs. The -h option keeps jobs in the table but marks them to not receive SIGHUP, useful when you want to monitor jobs but prevent termination. disown is commonly used when a long-running process was started without nohup and needs to survive shell exit. It works with both bash and zsh shells.

How do I run a basic disown example?

Run `disown` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a do in disown?

Disown all jobs.