How to get access of process running on one terminal from other terminal in Linux?
Solution 1
Pehaps you want something like reptyr
? (https://github.com/nelhage/reptyr)
You simply type reptyr PID
to 'gain control' of another process (like vim or whatnot).
Edit:
This question has more information on using screen or tools like reptyr.
Solution 2
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. - Run you program here
From second terminal
- Get in to existing screen using
screen -x test
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.
Related videos on Youtube
Praveen
Updated on June 04, 2022Comments
-
Praveen almost 2 years
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 .
- Both terminals belong to same system .
-
salva over 12 yearsThere is no such thing as taking control of some process already running. The most similar thing is using
screen
as described by abhi_ksd. -
Jonathan almost 10 yearsGiven @onionjake's answer, this is a great question.