Randall, My strategy at this point would be to browse my Bash command history, and try to find a 'cd' command preceding 'my-bash-command'. I'd then look for the *logfile*.
Failing that I'd use 'locate logfile' and filter the resulting output. That only works if your system is configured to use 'locate'. I'd recommend using full path names for your logfiles, or a directory where you dump 'tee'd output. On Wed, May 7, 2025 at 1:39 PM Matt Kowalczyk <[email protected]> wrote: > bash and tee processes would be under the same process group number. The > below example is from FreeBSD. > > $ sleep 10 | sleep 20 & > [1] 42632 > $ ps -ux -o pid,ppid,pgid | grep -E 'sleep|PGID' > USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME > COMMAND PID PPID PGID > XXX 42631 0.0 0.0 13740 2332 7 SC 13:37 0:00.00 sleep > 10 42631 42325 42631 > XXX 42632 0.0 0.0 13740 2336 7 SC 13:37 0:00.00 sleep > 20 42632 42325 42631 > XXX 42636 0.0 0.0 13836 2568 7 S+ 13:37 0:00.00 grep -E > sleep|PG 42636 42325 42635 > > On 5/7/2025 1:27 PM, American Citizen wrote: > > Hello: > > > > While the information in the /proc folder for a specific pid will > > allow one to find if the output is being sent to stdout or to a file, > > I am having problems with a situation where I piped the output to > > another command and ran both in the background. > > > > Take, for example > > > > % bash my_bash_script | tee logfile & > > > > Later on I close the terminal in which this command and pipe was > > executed and I forgot to memorize what I did. > > > > The pid for my_bash_script can be easily found by pgrep but how can I > > recover the "tee logfile" part, so I can examine logfile? > > > > Randall > > > > > -- > Matt Kowalczyk >
