Ubuntu – Is it possible to read the output from any process using its PID

command lineprocess

Is it possible to attach a terminal to an already running process by using its PID in a similar fashion to using the fg command for jobs?

Best Answer

You can get that process's standard file descriptors, e.g. stdout:

tail -f /proc/<pid>/fd/1