Search code examples
bashprocessstdoutstderr

Bash: get location of stderr and stdout


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?


Solution

  • With Linux, you can run:

    ls -l /proc/PROCESS_ID/fd/1 /proc/PROCESS_ID/fd/2