当前位置: 首页>>技术教程>>正文


如何在终端中打开应用程序并将其分离?

,

问题描述

我在终端中使用 open cairo-dock 打开了 Cairo-dock,这有效,但如果我关闭终端,它也会随之消失。无论终端如何,如何保持它打开?

最佳答案

\\n

nohup is a POSIX command to ignore the HUP (hangup) signal. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.\\n Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected.\\n nohup is a low-level utility simply configuring a command to ignore a signal. As seen below, nohup is very far from being a full-featured batch system solving all the problems of running programs asynchronously.

\\n

参见手册:

man nohup

例子:

nohup cairo-dock &

次佳答案

另一种方式:disown

In the bash shell, the disown builtin command is used to remove jobs from the job table, or to mark jobs so that a SIGHUP signal is not sent to them if the parent shell receives it (e.g. if the user logs out).

例如:

cairo-dock & disown

第三种答案

我个人使用屏幕来处理这类事情。

screen -d -m -S cairo_session open cairo-dock

这样做的好处是,如果您想终止 cairo-dock,您可以重新连接到屏幕会话并终止它。

screen -S cairo_session -X quit

Screen还有其他用途。它是一个终端多路复用器。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/14465.html,未经允许,请勿转载。