3

A user has started a Java program and is currently running.

As root, I can see it through ps -A.

How can I bring this process to foreground?

1 Answer 1

7

The short answer is: A process can only be brought to the foreground in the terminal it was started in. Its stdin, stdout and stderr are linked to that window and they can't be changed from the outside i.e. from another process.

The long answer is: There are some options to see some of its output, see here

2
  • Is there a way to write into its stdin in terminal? Commented Aug 3, 2015 at 7:29
  • 1
    You can send characters using echo 'abcd' > /proc/PID/fd/0, but they are likely not executed. Another option is to use reptyr -s PID. (I couldn't get it to work though). In both cases PID is the process id of the process you are trying to attach to. Commented Aug 3, 2015 at 7:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.