/proc/$PID/exe seems to be what you're looking for: (proc(5):
/proc/[pid]/exe
Under Linux 2.2 and later, this file is a symbolic link containing the actual pathname of the executed command. This symbolic link can be dereferenced normally; attempting to open it will open the executable.
So, simply:
$ /bin/cat & ls -lreadlink /proc/$!/exe lrwxrwxrwx 1 itvirta itvirta 0 May 27 18:14 /proc/11335/exe -> /bin/cat*cat It actually follows renames on the executable file:
$/tmp$ cp /bin/cat . ; ./cat & mv cat dog ; ls -lreadlink /proc/$!/exe lrwxrwxrwx 1 itvirta itvirta 0 May 27 18:14 /proc/11304/exe -> /tmp/dog*dog