Is it possible to find the path of a running program

process

I have a xmms2d process running, but two possible executable files (in different directories, both in the executable path) that could have spawned it. I suspect that one of those is corrupted, because sometimes this program works and sometimes it doesn't. The process running now works, so I want to delete (or rename) the other one.

ps ax|grep "xmms" returns 8505 ? SLl 2:38 xmms2d -v without path information. Given the PID, could I find whether it was run from /usr/bin/xmms2d or /usr/local/bin/xmms2d?

Thanks!

Best Answer

Try this:

ls -l /proc/8505/exe

Or if you don't want to parse the output of ls, just do:

readlink /proc/8505/exe

or

realpath /proc/8505/exe
Related Question