如何在unix中从终端分离进程? [英] How to detach a process from terminal in unix?

查看:33
本文介绍了如何在unix中从终端分离进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在终端的后台启动一个进程时,如果终端关闭,我们将无法再与该进程交互.我不确定,但我认为进程也会被杀死.任何人都可以告诉我如何从我的终端中分离该进程.所以即使我关闭终端,我也可以在新终端中与相同的进程交互?

When I start a process in background in a terminal and some how if terminal gets closed then we can not interact that process any more. I am not sure but I think process also get killed. Can any one please tell me how can I detach that process from my terminal. So even if I close terminal then I can interact with same process in new terminal ?

我是 unix 新手,所以你的额外信息会对我有所帮助.

I am new to unix so your extra information will help me.

推荐答案

您也可以考虑使用 screen 命令.它具有恢复我的会话"功能.诚然,我从未使用过它,并且忘记了它.

You might also consider the screen command. It has the "restore my session" functionality. Admittedly I have never used it, and forgot about it.

将进程作为守护进程启动,或使用 nohup 可能无法完成您想要的一切,就重新捕获 stdout/stdin 而言.

Starting the process as a daemon, or with nohup might not do everything you want, in terms of re-capturing stdout/stdin.

网上有很多例子.在谷歌尝试,unix 屏幕命令"和unix 屏幕教程":

There's a bunch of examples on the web. On google try, "unix screen command" and "unix screen tutorial":

这篇关于如何在unix中从终端分离进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆