How to get access of process running on one terminal from other terminal in Linux?

17,175

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

  1. Start a screen using screen -dR test and hit Enter, you will get shell within in screen.
  2. Run you program here

From second terminal

  1. 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.

Share:
17,175

Related videos on Youtube

Praveen
Author by

Praveen

Updated on June 04, 2022

Comments

  • Praveen
    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
      salva over 12 years
      There 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
      Jonathan almost 10 years
      Given @onionjake's answer, this is a great question.