# Find out which file a process is writing when PID changes all the time

Using tools like iotop one can monitor the i/o of individual processes which is fine, but you do not find out which directory a process writes into. If the PID would always be the same that would not be a problem, one could strace or something else to find out which files are affected, or possibly

lsof +p <PID>


But I noticed chromium does some heavy disk writes when I open a video, despite the fact that I already put many directories associated with chromium on a tmpfs. Now I would like to find out which directories it writes to in the instant iotop shows the high i/o usage. Chromium does change the PID all the time, which makes this even more complex.

-
What about running strace chromium? Not sure if that will include the sub-processes launched for the tabs but it might help. –  terdon Apr 19 '14 at 13:24

We may use pidof to determine the PID(s) of an application for iotop
sudo iotop -p $(pidof chromium-browser | sed -r 's/[ ]+/ -p /g')  For any other command needing a different separator of the PID list replace the separator in the sed command, e.g. top -p$(pidof chromium-browser | sed -r 's/[ ]+/,/g')

What release version are you? IIRC Chromium processes may now have different names dependent on roles. See ps aux | grep chromium. –  Takkat Apr 19 '14 at 17:38