Say, hypothetically, I start a process in the background and redirect its stdout
and stderr
to an arbitrary file somewhere. Months later, the process is still running and I've forgotten where that file is. If I know the process's ID how can I programatically determine the location to where it's sending its output?
With Linux, you can run:
ls -l /proc/PROCESS_ID/fd/1 /proc/PROCESS_ID/fd/2