小编ald*_*deb的帖子

使用关闭按钮关闭终端与 Ctrl-D 的区别

当我启动后台进程然后使用窗口的关闭按钮关闭终端时,后台进程被杀死。但是,如果我使用Ctrl+关闭终端D,后台进程将继续运行:

sam@Sam-Pc:~$ yes > /dev/null &
[1] 10219
// I then close the terminal a reopen a new one
sam@Sam-Pc:~$ ps aux | grep yes 
sam      10295  0.0  0.0  15948  2152 pts/8    S+   00:54   0:00 grep --color=auto yes
Run Code Online (Sandbox Code Playgroud)

现在使用Ctrl+D关闭终端:

sam@Sam-Pc:~$ yes > /dev/null &
[1] 10299
sam@Sam-Pc:~$Ctrl-D
// I then reopen a new terminal
sam@Sam-Pc:~$ ps aux | grep yes 
sam      10219 99.4  0.0  11404   812 ?        R    00:52   2:01 yes
sam …
Run Code Online (Sandbox Code Playgroud)

shell terminal signals process-management background-process

7
推荐指数
1
解决办法
1998
查看次数