How can I determine whether a particular folder in the PATH environment variable is used by the system?
Recently, some software that relied on the system PATH stopped working b/c another package added too many characters to the beginning the variable, causing important parts to be truncated at the end.
This led me to cleaning up the variable by removing some unused directories and shortening others; however, I still have quite a bit left over that I'm unsure of and I'm wondering if there is a way to determine whether certain parts of the PATH variable are used/unused by any process on the system.
Ideally I would love a list of dependencies, however, I would be happy with a method that can log failed/successful attempts. Any ideas?
EDIT
My goal is to determine if it's safe to remove a directory from PATH without breaking anything, therefore I need to know if a file was accessed specifically by looking it up in the PATH.