I want to know the procedure so that i can access or get control from terminal over the process running on some other terminal in Linux .
我想知道这个程序,以便我可以在Linux上的其他终端上运行的进程*问终端或从终端获得控制权。
- Both terminals belong to same system .
- 两个终端属于同一系统。
4 个解决方案
#1
10
Pehaps you want something like reptyr
? (https://github.com/nelhage/reptyr)
你想要像reptyr这样的东西吗? (https://github.com/nelhage/reptyr)
You simply type reptyr PID
to 'gain control' of another process (like vim or whatnot).
您只需键入reptyr PID以“控制”另一个进程(如vim或诸如此类)。
Edit:
编辑:
This question has more information on using screen or tools like reptyr.
此问题提供了有关使用屏幕或reptyr等工具的更多信息。
#2
3
Use the screen utility to start any process from terminal, so that you can access the same process from any other terminal either locally or remotely. For instance:
使用屏幕实用程序从终端启动任何进程,以便您可以从本地或远程从任何其他终端访问相同的进程。例如:
From first terminal
- Start a screen using
screen -dR test
and hit Enter, you will get shell within in screen. - 使用屏幕-dR测试启动屏幕并按Enter键,您将在屏幕内获得shell。
- Run you program here
- 在这里运行你的程序
From second terminal
- Get in to existing screen using
screen -x test
- 使用屏幕-x测试进入现有屏幕
Now you should be able to see process running on first terminal, and will have the full control over that process.
现在您应该能够看到在第一个终端上运行的进程,并且可以完全控制该进程。
You can investigate more on screen utility… its a very useful tool for any system administrator.
您可以在屏幕实用程序上进行更多调查...这对于任何系
Hope the above tip will help you.
希望以上提示能为您提供帮助。
#3
1
Are we talking SSH? If soo...
我们在谈论SSH吗?如果......
-
SSH into the host that has the process running:
SSH进入运行进程的主机:
ssh user@host
ssh user @ host
Then to view processes running on the host type:
然后查看在主机类型上运行的进程:
ps aux | less
ps aux |减
Gain Control? Not exactly sure what that means but ill list some simple commands.
获得控制权?不完全确定这意味着什么,但列出一些简单的命令。
-
View processes by "userName"
按“userName”查看流程
ps -u userName
ps -u userName
-
Look up Process
查找流程
pgrep firefox
pgrep firefox
-
Kill a process
杀死一个过程
example:
例:
pidof firefox
pidof firefox
output: (your number will be different.)
输出:(你的号码会有所不同。)
2786
2786
Now the kill:
现在杀了:
kill 2786
杀了2786
Advanced
高级
-
shows running processes as a tree.
将运行进程显示为树。
pstree
pstree
-
Might be interested in looking into atop
可能有兴趣研究一下
atop
在顶上
#4
0
I know this is an old thread. But in the event you want à duplicate of à linux tty you can use conspy http://linux.die.net/man/1/conspy It is small ans easy to compile if its not already on your distribution
我知道这是一个老话题。但是,如果你想要ààttytty的副本,你可以使用conspy http://linux.die.net/man/1/conspy它很小,很容易编译,如果它还没有你的发行版
#1
10
Pehaps you want something like reptyr
? (https://github.com/nelhage/reptyr)
你想要像reptyr这样的东西吗? (https://github.com/nelhage/reptyr)
You simply type reptyr PID
to 'gain control' of another process (like vim or whatnot).
您只需键入reptyr PID以“控制”另一个进程(如vim或诸如此类)。
Edit:
编辑:
This question has more information on using screen or tools like reptyr.
此问题提供了有关使用屏幕或reptyr等工具的更多信息。
#2
3
Use the screen utility to start any process from terminal, so that you can access the same process from any other terminal either locally or remotely. For instance:
使用屏幕实用程序从终端启动任何进程,以便您可以从本地或远程从任何其他终端访问相同的进程。例如:
From first terminal
- Start a screen using
screen -dR test
and hit Enter, you will get shell within in screen. - 使用屏幕-dR测试启动屏幕并按Enter键,您将在屏幕内获得shell。
- Run you program here
- 在这里运行你的程序
From second terminal
- Get in to existing screen using
screen -x test
- 使用屏幕-x测试进入现有屏幕
Now you should be able to see process running on first terminal, and will have the full control over that process.
现在您应该能够看到在第一个终端上运行的进程,并且可以完全控制该进程。
You can investigate more on screen utility… its a very useful tool for any system administrator.
您可以在屏幕实用程序上进行更多调查...这对于任何系
Hope the above tip will help you.
希望以上提示能为您提供帮助。
#3
1
Are we talking SSH? If soo...
我们在谈论SSH吗?如果......
-
SSH into the host that has the process running:
SSH进入运行进程的主机:
ssh user@host
ssh user @ host
Then to view processes running on the host type:
然后查看在主机类型上运行的进程:
ps aux | less
ps aux |减
Gain Control? Not exactly sure what that means but ill list some simple commands.
获得控制权?不完全确定这意味着什么,但列出一些简单的命令。
-
View processes by "userName"
按“userName”查看流程
ps -u userName
ps -u userName
-
Look up Process
查找流程
pgrep firefox
pgrep firefox
-
Kill a process
杀死一个过程
example:
例:
pidof firefox
pidof firefox
output: (your number will be different.)
输出:(你的号码会有所不同。)
2786
2786
Now the kill:
现在杀了:
kill 2786
杀了2786
Advanced
高级
-
shows running processes as a tree.
将运行进程显示为树。
pstree
pstree
-
Might be interested in looking into atop
可能有兴趣研究一下
atop
在顶上
#4
0
I know this is an old thread. But in the event you want à duplicate of à linux tty you can use conspy http://linux.die.net/man/1/conspy It is small ans easy to compile if its not already on your distribution
我知道这是一个老话题。但是,如果你想要ààttytty的副本,你可以使用conspy http://linux.die.net/man/1/conspy它很小,很容易编译,如果它还没有你的发行版