Once you have a PID, you can look inside /proc/ to get information around where it is executed.
One place with this info looks to be inside cat /proc/PID/environ, which shows the PWD (i.e. PWD=/mnt/rstudio-connect/apps/1011/3183 - in this case 1011 is the app id). There may be other places that are easier to parse, and obviously any of this could change based on Connect's internal process implementation changing. We will definitely log this request as product feedback for an easier way to introspect processes from the linux side.