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?


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

  • Is there a way to write into its stdin in terminal? – zzy Aug 3 '15 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. – NZD Aug 3 '15 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.