我是 Ubuntu 的新手。我用过 Sublime Text。我意识到在我从终端打开 Sublime Text 后,如果我关闭终端,应用程序会继续运行。对于其他应用程序(如geany
.
从终端打开应用程序后,当我关闭终端时,应用程序也会关闭。我试过&exit
像geany &exit
. 但这不是我要找的。
geany
关闭后如何继续运行?
Ter*_*nce 31
编辑:这可能仅适用于某些类型的终端。最好disown
在启动如下命令后再运行一个命令,以便应用程序与终端窗口解除关联。
在终端窗口中,输入
nohup geany > /dev/null
disown
Run Code Online (Sandbox Code Playgroud)
或者
nohup geany >/dev/null &
disown
Run Code Online (Sandbox Code Playgroud)
nohup
允许应用程序运行并且不受挂起影响,因此关闭终端窗口不会影响正在运行的应用程序。向>/dev/null
命令添加可防止在nohup.out
运行应用程序的每个目录中创建。
从手册页:
NAME
nohup - run a command immune to hangups, with output to a non-tty
SYNOPSIS
nohup COMMAND [ARG]...
nohup OPTION
Run Code Online (Sandbox Code Playgroud)
和
$ disown --help
disown: disown [-h] [-ar] [jobspec ... | pid ...]
Remove jobs from current shell.
Removes each JOBSPEC argument from the table of active jobs. Without
any JOBSPECs, the shell uses its notion of the current job.
Options:
-a remove all jobs if JOBSPEC is not supplied
-h mark each JOBSPEC so that SIGHUP is not sent to the job if the
shell receives a SIGHUP
-r remove only running jobs
Exit Status:
Returns success unless an invalid option or JOBSPEC is given.
Run Code Online (Sandbox Code Playgroud)
mni*_*iip 13
作为替代方案,nohup
您可以使用 shell builtin disown
。disown
从作业列表中删除作业,并且当 shell 存在时,SIGHUP
不会发送到该进程。
geany &
disown
exit
Run Code Online (Sandbox Code Playgroud)