关闭终端后如何保持应用程序运行?
我是Ubuntu的新手。 我使用过Sublime Text。 我已经意识到,在我从终端打开Sublime Text后,如果我关闭终端,应用程序将继续运行。 对于像geany
这样的其他应用程序也是如此。
从终端打开应用程序后,当我关闭终端时,应用程序也会关闭。 我试过&exit
像geany &exit
。 但这不是我要找的。
即使关闭它,我怎么能保持geany
运行?
在终端窗口中输入
nohup geany > /dev/null
要么
nohup geany >/dev/null &
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
作为nohup
的替代方案,您可以使用shell builtin disown
。 disown
从作业列表中删除作业,当shell存在时, SIGHUP
不会发送到该进程。
geany & disown exit
你可以使用exec geany & exit
(注意exec和&符号)如果你不需要root和pkexec geany & exit
如果你需要root权限。